1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 04:46:40 +07:00
vault-frontend/src/redux/auth/index.ts
2021-03-19 14:15:04 +07:00

60 lines
1 KiB
TypeScript

import { EMPTY_USER } from '~/redux/auth/constants';
import { createReducer } from '~/utils/reducer';
import { IAuthState } from '~/redux/auth/types';
import { AUTH_USER_HANDLERS } from '~/redux/auth/handlers';
const HANDLERS = {
...AUTH_USER_HANDLERS,
};
const INITIAL_STATE: IAuthState = {
token: '',
user: { ...EMPTY_USER },
is_tester: false,
updates: {
last: '',
notifications: [],
boris_commented_at: '',
},
login: {
error: '',
is_loading: false,
is_registering: true,
},
profile: {
tab: 'profile',
is_loading: true,
user: undefined,
patch_errors: {},
socials: {
accounts: [],
error: '',
is_loading: false,
},
},
restore: {
code: '',
user: undefined,
is_loading: false,
is_succesfull: false,
error: '',
},
register_social: {
errors: {
username: '',
password: '',
},
error: '',
token: '',
is_loading: false,
},
};
export default createReducer(INITIAL_STATE, HANDLERS);