Fix fetch calls to give unique urls proper names

This commit is contained in:
Emil Lindqvist 2021-11-05 09:57:17 +01:00 committed by Viktor Sarström
parent baf1aaa34a
commit 88e22df77d
1 changed files with 4 additions and 4 deletions

View File

@ -89,7 +89,7 @@ export class ApiHjarntorget extends EventEmitter implements Api {
startDateIso: from.toISODate(),
endDateIso: to.toISODate(),
}
const lessonsResponse = await this.fetch('info', lessonsUrl(lessonParams))
const lessonsResponse = await this.fetch('lessons', lessonsUrl(lessonParams))
const lessonsResponseJson: any[] = await lessonsResponse.json()
return lessonsResponseJson.map(l => {
@ -136,7 +136,7 @@ export class ApiHjarntorget extends EventEmitter implements Api {
async getUser(): Promise<User> {
const currentUserResponse = await this.fetch('myChildren', currentUserUrl)
const currentUserResponse = await this.fetch('currentUser', currentUserUrl)
if (currentUserResponse.status !== 200) {
return { isAuthenticated: false }
}
@ -245,7 +245,7 @@ export class ApiHjarntorget extends EventEmitter implements Api {
async getNewsDetails(_child: EtjanstChild, item: NewsItem): Promise<any> {
this.fetch('info', infoSetReadUrl(item), {
this.fetch('infoSetReadUrl', infoSetReadUrl(item), {
method: 'POST',
})
@ -325,7 +325,7 @@ export class ApiHjarntorget extends EventEmitter implements Api {
startDateIso: startDate.toISODate(),
endDateIso: endDate.toISODate(),
}
const lessonsResponse = await this.fetch('info', lessonsUrl(lessonParams))
const lessonsResponse = await this.fetch('lessons', lessonsUrl(lessonParams))
const lessonsResponseJson: any[] = await lessonsResponse.json()
return lessonsResponseJson.map(l => {