mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 04:46:40 +07:00
persisted user profile
This commit is contained in:
parent
4f86847e59
commit
8071a1644c
6 changed files with 42 additions and 17 deletions
|
@ -12,7 +12,7 @@ import { routerMiddleware } from 'connected-react-router'
|
|||
|
||||
const userPersistConfig: PersistConfig = {
|
||||
key: 'user',
|
||||
whitelist: ['user', 'logo', 'provider', 'speed'],
|
||||
whitelist: ['profile'],
|
||||
storage,
|
||||
};
|
||||
|
||||
|
|
|
@ -7,8 +7,10 @@ export interface IUserProfile {
|
|||
username: string,
|
||||
email: string,
|
||||
role: string,
|
||||
activated: boolean,
|
||||
token: string,
|
||||
|
||||
is_activated: boolean,
|
||||
is_user: boolean,
|
||||
}
|
||||
|
||||
export interface IUserFormStateLogin {
|
||||
|
@ -58,7 +60,8 @@ const INITIAL_STATE: IUserState = {
|
|||
email: '',
|
||||
role: '',
|
||||
token: '',
|
||||
activated: false,
|
||||
is_activated: false,
|
||||
is_user: false,
|
||||
},
|
||||
form_state: {
|
||||
login: {
|
||||
|
|
|
@ -14,9 +14,9 @@ function* sendLoginRequestSaga({ username, password }: ReturnType<typeof ActionC
|
|||
|
||||
if (!token) return yield put(userSetLoginError({ error: USER_STATUSES[status] || USER_ERRORS.INVALID_CREDENTIALS }));
|
||||
|
||||
const { id, role, email, activated } = user;
|
||||
const { id, role, email, activated: is_activated } = user;
|
||||
|
||||
yield put(userSetUser({ token, id, role, email, username: user.username, activated, }));
|
||||
yield put(userSetUser({ token, id, role, email, username: user.username, is_activated, is_user: true }));
|
||||
yield put(push('/'));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue