aboutsummaryrefslogtreecommitdiffstats
path: root/ui/src/state/models.ts
diff options
context:
space:
mode:
authorEllie Huxtable <ellie@elliehuxtable.com>2024-05-30 12:49:22 +0100
committerGitHub <noreply@github.com>2024-05-30 12:49:22 +0100
commit467f89c104df40904ef4c6b408507e90fe661724 (patch)
treee93697bdfa14ca6b083b0ea02c85d1d0688e0eba /ui/src/state/models.ts
parentchore(deps): bump rusty_paseto and rusty_paserk (#2054) (diff)
downloadatuin-467f89c104df40904ef4c6b408507e90fe661724.zip
feat(ui): add login/register dialog (#2056)
Diffstat (limited to 'ui/src/state/models.ts')
-rw-r--r--ui/src/state/models.ts16
1 files changed, 11 insertions, 5 deletions
diff --git a/ui/src/state/models.ts b/ui/src/state/models.ts
index 57db44ae..c1d97f4b 100644
--- a/ui/src/state/models.ts
+++ b/ui/src/state/models.ts
@@ -1,12 +1,18 @@
import Database from "@tauri-apps/plugin-sql";
-export interface User {
- username: string;
+export class User {
+ username: string | null;
+
+ constructor(username: string) {
+ this.username = username;
+ }
+
+ isLoggedIn(): boolean {
+ return this.username !== "" && this.username !== null;
+ }
}
-export const DefaultUser: User = {
- username: "",
-};
+export const DefaultUser: User = new User("");
export interface HomeInfo {
historyCount: number;