Connect frontend to backend

This commit is contained in:
2020-06-01 15:04:15 +02:00
parent a9671b8b0a
commit 52a0e48323
9 changed files with 95 additions and 55 deletions

View File

@@ -0,0 +1,18 @@
import TableEntry from "../models/TableEntry";
export default class UserStatsService {
private apiURL = '/stats'
private requestInit: RequestInit = {
headers: {
'Content-Type': 'application/json'
}
};
async getStats(): Promise<TableEntry[]> {
return fetch(this.apiURL, this.requestInit)
.then(res => { console.log(res); return res; })
.then(res => res.json())
}
}