git commit -m "feat: improve wheel UI with gold pointer and center circle sync"
40 lines
930 B
JavaScript
40 lines
930 B
JavaScript
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 = (data) =>
|
|
fetch(`${BASE}/admin/items`, {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
body: JSON.stringify(data)
|
|
}).then(r => r.json());
|
|
|
|
export const updateItem = (id, data) =>
|
|
fetch(`${BASE}/admin/items/${id}`, {
|
|
method: 'PUT',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
body: JSON.stringify(data)
|
|
}).then(r => r.json());
|
|
|
|
export const deleteItem = (id) =>
|
|
fetch(`${BASE}/admin/items/${id}`, {
|
|
method: 'DELETE'
|
|
}).then(r => {
|
|
if (r.status === 204) return {};
|
|
return r.json();
|
|
}); |