added roominvites in frontend in a notifications page and added clap to define backend port

This commit is contained in:
2025-12-31 12:14:46 +01:00
parent fb514f1efe
commit e7a575ae03
12 changed files with 258 additions and 145 deletions

41
src/authStore.ts Normal file
View File

@@ -0,0 +1,41 @@
import { load, Store } from '@tauri-apps/plugin-store'
let store: Store | null = null
async function getStore() {
if (!store) store = await load('store.json')
return store
}
export async function getAuthData() {
const s = await getStore()
const token = await s.get<string>('token')
const uuid = await s.get<string>('uuid')
return { token: token || null, uuid: uuid || null, isAuthenticated: !!token }
}
export async function saveAuthData(token: string, uuid: string) {
const s = await getStore()
await s.set('token', token)
await s.set('uuid', uuid)
await s.save()
}
export async function clearAuthData() {
const s = await getStore()
await s.delete('token')
await s.delete('uuid')
await s.save()
}
export async function setLastRoom(uuid: string) {
if (!uuid || uuid === 'none') return
const s = await getStore()
await s.set('last_room_uuid', uuid)
await s.save()
}
export async function getLastRoom(): Promise<string | null> {
const s = await getStore()
return (await s.get<string>('last_room_uuid')) ?? null
}