relogin on 403

This commit is contained in:
Primakov Alexandr Alexandrovich 2024-03-01 12:01:32 +03:00
parent 29b9d7a853
commit 37998bee63

View File

@ -8,6 +8,15 @@ export const api = createApi({
reducerPath: "auth",
baseQuery: fetchBaseQuery({
baseUrl: getConfigValue("journal.back.url"),
fetchFn: async (input: RequestInfo | URL, init?: RequestInit | undefined) => {
const response = await fetch(input, init);
if (response.status === 403) {
keycloak.login();
}
return response;
},
headers: {
"Content-Type": "application/json;charset=utf-8",
},