diff --git a/web/redux/redux-setup.js b/web/redux/redux-setup.js --- a/web/redux/redux-setup.js +++ b/web/redux/redux-setup.js @@ -61,6 +61,7 @@ import { defaultWebState } from './default-state.js'; import reduceNavInfo from './nav-reducer.js'; import { onStateDifference } from './redux-debug-utils.js'; +import { reduceServicesAccessToken } from './services-access-token-reducer.js'; import { getVisibility } from './visibility.js'; import { processDBStoreOperations } from '../database/utils/store.js'; import { activeThreadSelector } from '../selectors/nav-selectors.js'; @@ -345,6 +346,10 @@ ), cryptoStore: reduceCryptoStore(state.cryptoStore, action), communityPickerStore, + commServicesAccessToken: reduceServicesAccessToken( + state.commServicesAccessToken, + action, + ), }; return validateStateAndProcessDBOperations( diff --git a/web/redux/services-access-token-reducer.js b/web/redux/services-access-token-reducer.js new file mode 100644 --- /dev/null +++ b/web/redux/services-access-token-reducer.js @@ -0,0 +1,20 @@ +// @flow + +import { + identityLogInActionTypes, + identityRegisterActionTypes, +} from 'lib/actions/user-actions.js'; + +import type { Action } from './redux-setup.js'; + +function reduceServicesAccessToken(state: ?string, action: Action): ?string { + if ( + action.type === identityLogInActionTypes.success || + action.type === identityRegisterActionTypes.success + ) { + return action.payload.accessToken; + } + return state; +} + +export { reduceServicesAccessToken };