From 467f89c104df40904ef4c6b408507e90fe661724 Mon Sep 17 00:00:00 2001 From: Ellie Huxtable Date: Thu, 30 May 2024 12:49:22 +0100 Subject: feat(ui): add login/register dialog (#2056) --- ui/src/state/models.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'ui/src/state/models.ts') 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; -- cgit v1.3.1