1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-26 05:16:41 +07:00

added account list and ability to drop them

This commit is contained in:
Fedor Katurov 2020-07-26 18:31:15 +07:00
parent 2388a7e20e
commit 5396cf7611
11 changed files with 282 additions and 47 deletions

View file

@ -1,7 +1,6 @@
import { AUTH_USER_ACTIONS } from '~/redux/auth/constants';
import * as ActionCreators from '~/redux/auth/actions';
import { IAuthState } from '~/redux/auth/types';
import { Action } from 'history';
interface ActionHandler<T> {
(state: IAuthState, payload: T extends (...args: any[]) => infer R ? R : any): IAuthState;
@ -65,6 +64,16 @@ const setRestore: ActionHandler<typeof ActionCreators.authSetRestore> = (state,
...restore,
},
});
const setSocials: ActionHandler<typeof ActionCreators.authSetSocials> = (state, { socials }) => ({
...state,
profile: {
...state.profile,
socials: {
...state.profile.socials,
...socials,
},
},
});
export const AUTH_USER_HANDLERS = {
[AUTH_USER_ACTIONS.SET_LOGIN_ERROR]: setLoginError,
@ -74,4 +83,5 @@ export const AUTH_USER_HANDLERS = {
[AUTH_USER_ACTIONS.SET_UPDATES]: setUpdates,
[AUTH_USER_ACTIONS.SET_LAST_SEEN_MESSAGES]: setLastSeenMessages,
[AUTH_USER_ACTIONS.SET_RESTORE]: setRestore,
[AUTH_USER_ACTIONS.SET_SOCIALS]: setSocials,
};