@@ -155,29 +155,8 @@ 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',
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user