typo fix
This commit is contained in:
parent
7bdd8c77a2
commit
4386b6100e
|
|
@ -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<string, string> = { ...(init?.headers as Record<string, string>) };
|
||||
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));
|
||||
|
||||
|
|
|
|||
|
|
@ -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<string> {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user