Connect frontend to backend
This commit is contained in:
18
frontend/src/services/UserStatsService.ts
Normal file
18
frontend/src/services/UserStatsService.ts
Normal 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())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user