diff --git a/frontend/src/providers/APIProvider/APIProvider.jsx b/frontend/src/providers/APIProvider/APIProvider.jsx index 427f454..38f40c2 100644 --- a/frontend/src/providers/APIProvider/APIProvider.jsx +++ b/frontend/src/providers/APIProvider/APIProvider.jsx @@ -56,7 +56,7 @@ export function APIProvider({children}) { return if (error.response.status === 401) { - localStorage['user'] = null + localStorage.removeItem('user') setAccessTokenFromLocalStorage() } }) diff --git a/frontend/src/providers/config-provider/ConfigProvider.jsx b/frontend/src/providers/config-provider/ConfigProvider.jsx index b79e26a..e7d1dff 100644 --- a/frontend/src/providers/config-provider/ConfigProvider.jsx +++ b/frontend/src/providers/config-provider/ConfigProvider.jsx @@ -9,8 +9,7 @@ export function ConfigProvider({children}) { const [refreshToken, setRefreshToken] = useState() const setAccessTokenFromLocalStorage = useCallback(() => { - const lsItem = localStorage["user"] - const tokens = JSON.parse(lsItem !== 'null' ? lsItem : "{}") + const tokens = JSON.parse(localStorage["user"] ?? "{}") if (tokens.access != null) { setAccessToken(tokens.access) if (tokens.refresh) {