mirror of
https://github.com/austinried/subtracks.git
synced 2025-12-27 09:09:29 +01:00
13 lines
418 B
TypeScript
13 lines
418 B
TypeScript
import { atom } from 'jotai'
|
|
import { AppSettings } from '@app/models/settings'
|
|
import atomWithAsyncStorage from '@app/storage/atomWithAsyncStorage'
|
|
|
|
export const appSettingsAtom = atomWithAsyncStorage<AppSettings>('@appSettings', {
|
|
servers: [],
|
|
})
|
|
|
|
export const activeServerAtom = atom(get => {
|
|
const appSettings = get(appSettingsAtom)
|
|
return appSettings.servers.find(x => x.id === appSettings.activeServer)
|
|
})
|