wire profile components, login/register routes, spec-driven auth
- src/main.jsx: add /login, /register, /profile/* routes; wire profileComponents from react-auth; pass basePath to Admin - src/Header.tsx: profile button nav to /profile/me; Login to /login - src/openapi-config.ts: wire getToken and profileComponents - react-auth local: sync ProfileCreate, ProfileEdit, ProfileView - react-openapi local: sync all auth + x-profile changes (AppProvider, Admin, ProfileRoutes, SideMenu, types, hooks, etc.)
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import axios, { AxiosInstance } from "axios";
|
||||
import { tokenStore } from "../../../react-auth/token";
|
||||
|
||||
let apiClient: AxiosInstance | null = null;
|
||||
|
||||
@@ -21,19 +20,6 @@ export function initApi(baseUrl: string, getToken?: () => string | null): AxiosI
|
||||
return config;
|
||||
});
|
||||
|
||||
apiClient.interceptors.response.use(
|
||||
(res) => res,
|
||||
(error) => {
|
||||
if (error.response?.status === 401 && getToken) {
|
||||
const currentToken = getToken();
|
||||
if (currentToken) {
|
||||
tokenStore.clear();
|
||||
}
|
||||
}
|
||||
return Promise.reject(error);
|
||||
}
|
||||
);
|
||||
|
||||
return apiClient;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user