If child has no timetableId they have no timetable and we should not ask server for one

This commit is contained in:
Andreas Eriksson 2021-09-10 22:49:01 +02:00
parent befb073a32
commit 47643d670a
1 changed files with 6 additions and 1 deletions

View File

@ -416,8 +416,13 @@ export class Api extends EventEmitter {
return key as string
}
public async getTimetable(child: Skola24Child, week: number, year: number, lang: Language): Promise<any> {
public async getTimetable(child: Skola24Child, week: number, year: number, lang: Language)
: Promise<TimetableEntry[]> {
if (this.isFake) return fakeResponse(fake.timetable(child))
if(!child.timetableID) {
return new Array<TimetableEntry>()
}
const url = routes.timetable
const renderKey = await this.getRenderKey()