This commit is contained in:
h
2026-04-06 15:36:51 +09:00
parent 1081ea1074
commit 2e9e100178
10 changed files with 216 additions and 20 deletions

View File

@@ -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) {