ocw/front/src/index.ts

12 lines
321 B
TypeScript
Raw Normal View History

2020-10-02 01:06:09 +02:00
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);
});
});