refinement phase 4

This commit is contained in:
hamid
2026-07-13 12:29:00 +03:30
parent 314763f764
commit 64f6aa45c9
27 changed files with 308 additions and 243 deletions
+5 -1
View File
@@ -36,9 +36,13 @@ export async function clientFetch<T>(path: string, options?: RequestInit, isRetr
const locale = window.location.pathname.split('/')[1] || 'fa';
const reqHeaders: Record<string, string> = {
'Content-Type': 'application/json',
'Accept-Language': locale,
};
// Let the browser set `Content-Type` (with the multipart boundary) for FormData bodies — a manual
// JSON content-type there breaks the upload. JSON bodies still declare it explicitly.
if (!(options?.body instanceof FormData)) {
reqHeaders['Content-Type'] = 'application/json';
}
if (token) {
reqHeaders['Authorization'] = `Bearer ${token}`;
}