Commit
This commit is contained in:
@@ -1,8 +1,13 @@
|
||||
const API_BASE = (import.meta.env.VITE_API_BASE_URL ?? '') + '/api';
|
||||
|
||||
async function request(path, options = {}) {
|
||||
const hasBody = options.body !== undefined;
|
||||
const res = await fetch(`${API_BASE}${path}`, {
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
credentials: 'include',
|
||||
headers: {
|
||||
...(hasBody ? { 'Content-Type': 'application/json' } : {}),
|
||||
...(options.headers ?? {}),
|
||||
},
|
||||
...options,
|
||||
});
|
||||
if (!res.ok) {
|
||||
|
||||
Reference in New Issue
Block a user