This commit is contained in:
IGNY8 VPS (Salman)
2025-11-30 00:21:00 +00:00
parent d2f3f3ef97
commit 550a8f26a2
5 changed files with 144 additions and 33 deletions

View File

@@ -155,8 +155,29 @@ export const importTableData = async (
const queryString = params.toString();
const url = `${API_BASE_URL}${endpoint}${queryString ? `?${queryString}` : ''}`;
// Get authentication token (consistent with other API calls)
const getAuthToken = () => {
try {
const authStorage = localStorage.getItem('auth-storage');
if (authStorage) {
const parsed = JSON.parse(authStorage);
return parsed?.state?.token || null;
}
} catch (e) {
// Ignore parsing errors
}
return null;
};
const token = getAuthToken();
const headers: HeadersInit = {};
if (token) {
headers['Authorization'] = `Bearer ${token}`;
}
const response = await fetch(url, {
method: 'POST',
headers,
body: formData,
credentials: 'include',
});