forked from hplush/slowreader
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsettings.ts
More file actions
27 lines (21 loc) · 688 Bytes
/
Copy pathsettings.ts
File metadata and controls
27 lines (21 loc) · 688 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { persistentAtom } from '@nanostores/persistent'
import { nanoid } from 'nanoid'
import { getClient } from './client.js'
import { getEnvironment } from './environment.js'
export const userId = persistentAtom<string | undefined>('slowreader:userId')
export async function signOut(): Promise<void> {
await getClient().clean()
userId.set(undefined)
getEnvironment().restartApp()
}
export function generateCredentials(): void {
userId.set(nanoid(10))
}
export const theme = persistentAtom<'dark' | 'light' | 'system'>(
'slowreader:theme',
'system'
)
export const preloadImages = persistentAtom<'always' | 'free' | 'never'>(
'slowreader:preloadImages',
'always'
)