Skip to content

Commit

Permalink
chore: Add check for empty user token in TimeTable class
Browse files Browse the repository at this point in the history
  • Loading branch information
vyPal committed Jul 6, 2024
1 parent 86e67d4 commit e4b3c93
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,10 @@ class TimeTable {
return timetables[dateOnly]!;
}

if (data.user.token == "") {
return TimeTableData(date, [], []);
}

Response response = await data.dio.get(
"${data.baseUrl}/api/timetable?to=${DateFormat('yyyy-MM-dd\'T\'HH:mm:ss\'Z\'', 'en_US').format(DateTime(date.year, date.month, date.day))}&from=${DateFormat('yyyy-MM-dd\'T\'HH:mm:ss\'Z\'', 'en_US').format(DateTime(date.year, date.month, date.day))}",
options: Options(
Expand Down

0 comments on commit e4b3c93

Please sign in to comment.