-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactoring, add initDapp function, set nativeAuthCofig at init
- Loading branch information
1 parent
6ec1ba6
commit 3611c64
Showing
25 changed files
with
197 additions
and
151 deletions.
There are no files selected for viewing
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
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,2 +1,2 @@ | ||
export * from './ProviderFactory'; | ||
export * from './providers/ProviderFactory'; | ||
export * from './Logger'; |
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { initStore } from 'store/store'; | ||
import { defaultStorageCallback, StorageCallback } from 'store/storage'; | ||
import { setTokenLoginNativeAuthTokenConfig } from 'store/actions/loginInfo/loginInfoActions'; | ||
import { NativeAuthConfigType } from 'services/nativeAuth/nativeAuth.types'; | ||
import { getDefaultNativeAuthConfig } from 'services/nativeAuth/methods/getDefaultNativeAuthConfig'; | ||
|
||
type InitAppType = { | ||
storage?: { | ||
getStorageCallback: StorageCallback; | ||
}; | ||
nativeAuth?: boolean | NativeAuthConfigType; | ||
}; | ||
const defaultInitAppProps = { | ||
storage: { | ||
getStorageCallback: defaultStorageCallback | ||
} | ||
}; | ||
export const initializeDApp = (props?: InitAppType) => { | ||
const { storage, nativeAuth } = { ...defaultInitAppProps, ...props }; | ||
initStore(storage.getStorageCallback); | ||
|
||
if (nativeAuth) { | ||
const nativeAuthConfig: NativeAuthConfigType = | ||
typeof nativeAuth === 'boolean' | ||
? getDefaultNativeAuthConfig() | ||
: nativeAuth; | ||
|
||
setTokenLoginNativeAuthTokenConfig(nativeAuthConfig); | ||
} | ||
}; |
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
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
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
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
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
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
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
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
Oops, something went wrong.