From 4386b6100e3863561f6742902315e9737bd79209 Mon Sep 17 00:00:00 2001 From: brooktewabe Date: Fri, 17 Apr 2026 11:37:28 +0300 Subject: [PATCH] typo fix --- src/lib/api.ts | 5 ++--- src/lib/auth-api.ts | 4 +--- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/lib/api.ts b/src/lib/api.ts index 9f7fc24..c6931db 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -1,6 +1,5 @@ import { parseApiError } from '@/lib/auth-api'; -const API_PREFIX = '/api'; function getBaseUrl(): string { return import.meta.env.VITE_API_BASE_URL ?? ''; @@ -56,7 +55,7 @@ async function request( if (body !== undefined && !isFormData) headers["Content-Type"] = "application/json"; if (token) headers.Authorization = `Bearer ${token}`; - const url = `${getBaseUrl()}${API_PREFIX}${resolved}`; + const url = `${getBaseUrl()}${resolved}`; return fetch(url, { ...init, method, @@ -103,7 +102,7 @@ export async function apiDownloadBlob( const headers: Record = { ...(init?.headers as Record) }; if (token) headers.Authorization = `Bearer ${token}`; - const url = `${getBaseUrl()}${API_PREFIX}${resolved}`; + const url = `${getBaseUrl()}${resolved}`; const res = await fetch(url, { ...init, method: 'GET', headers }); if (!res.ok) throw new Error(await parseApiError(res)); diff --git a/src/lib/auth-api.ts b/src/lib/auth-api.ts index ca9cab7..c3b5272 100644 --- a/src/lib/auth-api.ts +++ b/src/lib/auth-api.ts @@ -1,7 +1,5 @@ import type { RegisterHotelStaffDto, StaffAccess } from "@/lib/types"; -const API_ROOT = "/api"; - let getPropertyId: () => string | null = () => null; /** Register property scope for hotel auth-API paths (e.g. staff management). */ @@ -31,7 +29,7 @@ function rewriteHotelPath(path: string): string { function apiUrl(path: string): string { const base = import.meta.env.VITE_API_BASE_URL ?? ""; const resolved = rewriteHotelPath(path); - return `${base}${API_ROOT}${resolved}`; + return `${base}${resolved}`; } export async function parseApiError(res: Response): Promise {