fix: data loading after login fixed

This commit is contained in:
2025-07-04 21:12:01 +04:00
parent c3d135eba9
commit c866231730
6 changed files with 35 additions and 27 deletions

View File

@@ -1,5 +1,6 @@
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
import { jwtDecode, JwtPayload as JwtPayloadBase } from "jwt-decode";
import { OpenAPI } from "../client";
interface AuthState {
isAuthorized: boolean;
@@ -38,6 +39,7 @@ const authSlice = createSlice({
const { sub, role } = jwtDecode<JwtPayload>(
action.payload.accessToken,
);
OpenAPI.TOKEN = action.payload.accessToken;
state.accessToken = action.payload.accessToken;
state.isAuthorized = true;
state.role = role;