ocw/front/src/index.ts
2020-10-02 01:06:09 +02:00

12 lines
321 B
TypeScript

const request = (resource: string, data: any) => fetch(`/api/${resource}.shs`, {
method: 'POST',
body: new URLSearchParams(data).toString(),
}).then((res) => res.json());
document.addEventListener('load', () => {
request('packages', {})
.then((res) => {
console.log(res);
});
});