refactor: Use IS_PLATFORM constant for platform detection in authenticatedFetch function (backend)

This commit is contained in:
Haileyesus
2026-01-31 14:35:26 +03:00
parent cfd766819a
commit 8bea3d83c8

View File

@@ -1,6 +1,7 @@
import { IS_PLATFORM } from "../../shared/modelConstants";
// Utility function for authenticated API calls
export const authenticatedFetch = (url, options = {}) => {
const isPlatform = import.meta.env.VITE_IS_PLATFORM === 'true';
const token = localStorage.getItem('auth-token');
const defaultHeaders = {};
@@ -10,7 +11,7 @@ export const authenticatedFetch = (url, options = {}) => {
defaultHeaders['Content-Type'] = 'application/json';
}
if (!isPlatform && token) {
if (!IS_PLATFORM && token) {
defaultHeaders['Authorization'] = `Bearer ${token}`;
}