pl-fe: fix regression

Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
nicole mikołajczyk
2026-02-01 23:44:36 +01:00
parent bb602176c4
commit f913db1b17

View File

@ -1,5 +1,3 @@
import { router } from 'pl-fe/features/ui/router';
import { import {
AUTH_LOGGED_OUT, AUTH_LOGGED_OUT,
AUTH_ACCOUNT_REMEMBER_SUCCESS, AUTH_ACCOUNT_REMEMBER_SUCCESS,
@ -21,7 +19,6 @@ const initialState: Me = null;
const handleForbidden = (state: Me, error: { response: PlfeResponse }) => { const handleForbidden = (state: Me, error: { response: PlfeResponse }) => {
if (([401, 403] as any[]).includes(error.response?.status)) { if (([401, 403] as any[]).includes(error.response?.status)) {
router.invalidate();
return false; return false;
} else { } else {
return state; return state;
@ -32,15 +29,12 @@ const me = (state: Me = initialState, action: AuthAction | MeAction): Me => {
switch (action.type) { switch (action.type) {
case ME_FETCH_SUCCESS: case ME_FETCH_SUCCESS:
case ME_PATCH_SUCCESS: case ME_PATCH_SUCCESS:
router.invalidate();
return action.me.id; return action.me.id;
case VERIFY_CREDENTIALS_SUCCESS: case VERIFY_CREDENTIALS_SUCCESS:
case AUTH_ACCOUNT_REMEMBER_SUCCESS: case AUTH_ACCOUNT_REMEMBER_SUCCESS:
router.invalidate();
return state || action.account.id; return state || action.account.id;
case ME_FETCH_SKIP: case ME_FETCH_SKIP:
case AUTH_LOGGED_OUT: case AUTH_LOGGED_OUT:
router.invalidate();
return false; return false;
case ME_FETCH_FAIL: case ME_FETCH_FAIL:
return handleForbidden(state, action.error as any); return handleForbidden(state, action.error as any);