Type generateAuthActions config and remove storage.generateAuthActions

This commit is contained in:
kazukinagata 2020-07-26 15:21:21 +09:00
parent 33ed6ad156
commit b091e39189
2 changed files with 9 additions and 3 deletions

View File

@ -37,6 +37,7 @@ import {
SignOutRequestFailedAction,
SetHasVerificationBeenAttemptedAction,
AppThunk,
GenerateAuthActionsConfig,
} from './types'
import AsyncLocalStorage from './AsyncLocalStorage'
import {
@ -121,15 +122,14 @@ export const setHasVerificationBeenAttempted = (
// Async Redux Thunk actions:
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
const generateAuthActions = (config: { [key: string]: any }) => {
const generateAuthActions = (config: GenerateAuthActionsConfig) => {
const {
authUrl,
storage,
userAttributes,
userRegistrationAttributes,
} = config
const Storage: DeviceStorage = Boolean(storage.flushGetRequests) ? storage : AsyncLocalStorage
const Storage: DeviceStorage = AsyncLocalStorage
const registerUser = (
userRegistrationDetails: UserRegistrationDetails,

View File

@ -220,3 +220,9 @@ export interface DeviceStorage {
readonly multiGet: (keys: string[]) => Promise<any>
readonly multiSet: (keyValuePairs: string[][]) => Promise<any>
}
export interface GenerateAuthActionsConfig {
authUrl: string
userAttributes: {[key: string]: any}
userRegistrationAttributes: {[key: string]: any}
}