add workspace navbar status + creation modal

This commit is contained in:
2026-03-12 09:20:25 +08:00
parent bc099512db
commit 94489a7769
11 changed files with 648 additions and 16 deletions

View File

@@ -2,7 +2,6 @@ import { API_BASE_URL } from "../config/constants";
export const authFetch = async (endpoint: string, options: RequestInit = {}) => {
const token = localStorage.getItem("accessToken");
const isFormData = options.body instanceof FormData;
const headers: HeadersInit = {
@@ -11,7 +10,12 @@ export const authFetch = async (endpoint: string, options: RequestInit = {}) =>
...options.headers,
};
const response = await fetch(`${API_BASE_URL}${endpoint}`, {
// Safely join URLs preventing double slashes (e.g., "http://api.com//api/..." -> "http://api.com/api/...")
const cleanBaseUrl = API_BASE_URL.replace(/\/+$/, "");
const cleanEndpoint = endpoint.startsWith("/") ? endpoint : `/${endpoint}`;
const url = `${cleanBaseUrl}${cleanEndpoint}`;
const response = await fetch(url, {
...options,
headers,
});