Skip to content

Commit

Permalink
fixed theme cookie setter
Browse files Browse the repository at this point in the history
  • Loading branch information
dheidemann committed Mar 6, 2024
1 parent 7cbd8eb commit b3fa316
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions frontend/lib/utils/cookie.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,11 @@ void setTokenCookieFromUrl() {
}

void setThemeCookie([String? theme]) {
theme ??= ThemeMode.system == ThemeMode.dark ? "dark" : "light";
if (theme == null && getValueOfCookie("theme") == null) {
theme = ThemeMode.system == ThemeMode.dark ? "dark" : "light";
}
int exp =
DateTime.now().add(const Duration(days: 365)).millisecondsSinceEpoch ~/
1000000;
setCookie("theme", theme, exp);
if (theme != null) setCookie("theme", theme, exp);
}

0 comments on commit b3fa316

Please sign in to comment.