Initial commit: Wycz WoW Portfolio

This commit is contained in:
2026-08-23 09:06:58 +00:00
commit cc5be652b8
93 changed files with 6502 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
window.api = {
async get(path) {
const r = await fetch(path);
if (!r.ok) {
let msg = `HTTP ${r.status}`;
try { const j = await r.json(); msg = j.error || msg; } catch {}
throw new Error(msg);
}
return r.json();
},
async send(method, path, body) {
const r = await fetch(path, {
method,
headers: { 'Content-Type': 'application/json' },
body: body ? JSON.stringify(body) : undefined
});
if (!r.ok) {
let msg = `HTTP ${r.status}`;
try { const j = await r.json(); msg = j.error || msg; } catch {}
throw new Error(msg);
}
return r.json();
},
post(path, body) { return this.send('POST', path, body); },
put(path, body) { return this.send('PUT', path, body); },
del(path) { return this.send('DELETE', path); }
};