mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 12:56:41 +07:00
user menu
This commit is contained in:
parent
aff052e66d
commit
8a37fa1f1b
7 changed files with 135 additions and 62 deletions
|
@ -28,3 +28,7 @@ export const authSetUser = (profile: Partial<IUser>) => ({
|
|||
type: AUTH_USER_ACTIONS.SET_USER,
|
||||
profile,
|
||||
});
|
||||
|
||||
export const authLogout = () => ({
|
||||
type: AUTH_USER_ACTIONS.LOGOUT,
|
||||
});
|
||||
|
|
|
@ -6,6 +6,8 @@ export const AUTH_USER_ACTIONS = {
|
|||
SET_USER: 'SET_USER',
|
||||
SET_TOKEN: 'SET_TOKEN',
|
||||
|
||||
LOGOUT: 'LOGOUT',
|
||||
|
||||
GOT_POST_MESSAGE: 'GOT_POST_MESSAGE',
|
||||
};
|
||||
|
||||
|
|
|
@ -85,8 +85,14 @@ function* gotPostMessageSaga({ token }: ReturnType<typeof gotPostMessage>) {
|
|||
if (is_shown && dialog === DIALOGS.LOGIN) yield put(modalSetShown(false));
|
||||
}
|
||||
|
||||
function* logoutSaga() {
|
||||
yield put(authSetToken(null));
|
||||
yield put(authSetUser({ ...EMPTY_USER }));
|
||||
}
|
||||
|
||||
function* authSaga() {
|
||||
yield takeLatest(REHYDRATE, checkUserSaga);
|
||||
yield takeLatest(AUTH_USER_ACTIONS.LOGOUT, logoutSaga);
|
||||
yield takeLatest(AUTH_USER_ACTIONS.SEND_LOGIN_REQUEST, sendLoginRequestSaga);
|
||||
yield takeLatest(AUTH_USER_ACTIONS.GOT_POST_MESSAGE, gotPostMessageSaga);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue