feat: implement auth, projects, and frontend foundation

This commit is contained in:
2026-05-17 20:21:55 +00:00
parent e7819bfc82
commit 71d9fe6406
88 changed files with 10936 additions and 47 deletions
+26
View File
@@ -0,0 +1,26 @@
import axios from "axios";
const BASE_URL = import.meta.env.VITE_API_BASE_URL ?? "http://localhost:8000";
export const apiClient = axios.create({
baseURL: BASE_URL,
withCredentials: true,
headers: {
"Content-Type": "application/json"
}
});
export const shouldSkipAuthRedirect = (path: string): boolean => {
return path.startsWith("/login") || path.startsWith("/auth");
};
apiClient.interceptors.response.use(
(response) => response,
(error) => {
const status = error?.response?.status;
if (status === 401 && !shouldSkipAuthRedirect(window.location.pathname)) {
window.location.assign("/auth/login");
}
return Promise.reject(error);
}
);