-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(@aws-amplify/datastore): remove conditional require (#8828)
- Loading branch information
Showing
2 changed files
with
5 additions
and
5 deletions.
There are no files selected for viewing
8 changes: 4 additions & 4 deletions
8
packages/datastore/src/storage/adapter/getDefaultAdapter/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
import { browserOrNode, isWebWorker } from '@aws-amplify/core'; | ||
import { Adapter } from '..'; | ||
import IndexedDBAdapter from '../IndexedDBAdapter'; | ||
import AsyncStorageAdapter from '../AsyncStorageAdapter'; | ||
|
||
const getDefaultAdapter: () => Adapter = () => { | ||
const { isBrowser } = browserOrNode(); | ||
|
||
if ((isBrowser && window.indexedDB) || (isWebWorker() && self.indexedDB)) { | ||
return require('../IndexedDBAdapter').default; | ||
return IndexedDBAdapter; | ||
} | ||
|
||
const { AsyncStorageAdapter } = require('../AsyncStorageAdapter'); | ||
|
||
return new AsyncStorageAdapter(); | ||
return AsyncStorageAdapter; | ||
}; | ||
|
||
export default getDefaultAdapter; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters