lets hope this doesn't break stuff
This commit is contained in:
@@ -18,7 +18,10 @@ export async function fetchClient<T>(
|
||||
const { method = 'GET', body, headers = {}, ...rest } = options;
|
||||
|
||||
const apiUrl = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:3001';
|
||||
const url = `${apiUrl}/api${endpoint.startsWith('/') ? endpoint : `/${endpoint}`}`;
|
||||
|
||||
// Check if endpoint already includes /api
|
||||
const apiPrefix = endpoint.includes('/api/') ? '' : '/api';
|
||||
const url = `${apiUrl}${apiPrefix}${endpoint.startsWith('/') ? endpoint : `/${endpoint}`}`;
|
||||
|
||||
const fetchOptions: RequestInit = {
|
||||
method,
|
||||
|
||||
Reference in New Issue
Block a user