Refactor limqRequest function to remove default localhost URL and add CORS mode for API requests.
This commit is contained in:
@@ -21,7 +21,7 @@ export async function limqRequest<T = unknown>(
|
||||
throw new Error('No active session. User must be authenticated.');
|
||||
}
|
||||
|
||||
const baseUrl = process.env.NEXT_PUBLIC_LIMQ_API || 'http://localhost:3005';
|
||||
const baseUrl = process.env.NEXT_PUBLIC_LIMQ_API;
|
||||
const url = `${baseUrl}${endpoint.startsWith('/') ? endpoint : '/' + endpoint}`;
|
||||
|
||||
const options: RequestInit = {
|
||||
@@ -29,7 +29,8 @@ export async function limqRequest<T = unknown>(
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': `Bearer ${session.access_token}`
|
||||
}
|
||||
},
|
||||
mode: 'cors'
|
||||
};
|
||||
|
||||
if (data && (method === 'POST' || method === 'PUT')) {
|
||||
|
||||
Reference in New Issue
Block a user