Skip to content

Commit

Permalink
fix(@aws-amplify/datastore): remove conditional require (#8828)
Browse files Browse the repository at this point in the history
  • Loading branch information
iartemiev authored Aug 31, 2021
1 parent 6efc50a commit 48b76e1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
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;
2 changes: 1 addition & 1 deletion packages/datastore/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ export type DataStoreConfig = {
};

export type AuthProviders = {
functionAuthProvider: Promise<string>;
functionAuthProvider: () => { token: string } | Promise<{ token: string }>;
};

export enum AuthModeStrategyType {
Expand Down

0 comments on commit 48b76e1

Please sign in to comment.