Changeset View
Changeset View
Standalone View
Standalone View
lib/reducers/data-loaded-reducer.js
// @flow | // @flow | ||||
import { setDataLoadedActionType } from '../actions/client-db-store-actions.js'; | |||||
import { siweAuthActionTypes } from '../actions/siwe-actions.js'; | import { siweAuthActionTypes } from '../actions/siwe-actions.js'; | ||||
import { | import { | ||||
logOutActionTypes, | logOutActionTypes, | ||||
deleteAccountActionTypes, | deleteAccountActionTypes, | ||||
logInActionTypes, | logInActionTypes, | ||||
registerActionTypes, | registerActionTypes, | ||||
} from '../actions/user-actions.js'; | } from '../actions/user-actions.js'; | ||||
import type { BaseAction } from '../types/redux-types.js'; | import type { BaseAction } from '../types/redux-types.js'; | ||||
import { setNewSessionActionType } from '../utils/action-utils.js'; | import { setNewSessionActionType } from '../utils/action-utils.js'; | ||||
export default function reduceDataLoaded( | export default function reduceDataLoaded( | ||||
state: boolean, | state: boolean, | ||||
action: BaseAction, | action: BaseAction, | ||||
): boolean { | ): boolean { | ||||
if ( | if (action.type === setDataLoadedActionType) { | ||||
return action.payload.dataLoaded; | |||||
} else if ( | |||||
action.type === logInActionTypes.success || | action.type === logInActionTypes.success || | ||||
action.type === siweAuthActionTypes.success || | action.type === siweAuthActionTypes.success || | ||||
action.type === registerActionTypes.success | action.type === registerActionTypes.success | ||||
) { | ) { | ||||
return true; | return true; | ||||
} else if ( | } else if ( | ||||
action.type === setNewSessionActionType && | action.type === setNewSessionActionType && | ||||
action.payload.sessionChange.currentUserInfo && | action.payload.sessionChange.currentUserInfo && | ||||
Show All 12 Lines |