feat: add user and admin page

This commit is contained in:
2026-05-24 02:27:31 +03:30
parent be6e1fab8e
commit 2d99f0554d
19 changed files with 303 additions and 30 deletions

20
frontend/assets/js/api.js Normal file
View File

@@ -0,0 +1,20 @@
const BASE = 'http://127.0.0.1:8000';
export const getItems = () =>
fetch(`${BASE}/user/items`).then(r => r.json());
export const spinWheel = () =>
fetch(`${BASE}/user/spin`, { method: 'POST' }).then(r => r.json());
export const adminGetItems = () =>
fetch(`${BASE}/admin/items`).then(r => r.json());
export const createItem = (title) =>
fetch(`${BASE}/admin/items`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ title })
}).then(r => r.json());
export const deleteItem = (id) =>
fetch(`${BASE}/admin/items/${id}`, { method: 'DELETE' }).then(r => r.json());