mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-11 02:38:49 +00:00
29 lines
782 B
TypeScript
29 lines
782 B
TypeScript
import { writable } from 'svelte/store'
|
|
|
|
import { createQuery } from '@hcengineering/presentation'
|
|
import desktopPreferences, {
|
|
defaultNotificationPreference,
|
|
type DesktopNotificationPreference,
|
|
type DesktopNotificationPreferenceData
|
|
} from '@hcengineering/desktop-preferences'
|
|
|
|
// /**
|
|
// * @public
|
|
// */
|
|
export const activePreferences = writable<DesktopNotificationPreferenceData | DesktopNotificationPreference>(
|
|
defaultNotificationPreference
|
|
)
|
|
|
|
const preferencesQuery = createQuery(true)
|
|
preferencesQuery.query(
|
|
desktopPreferences.class.DesktopNotificationPreference,
|
|
{},
|
|
(res: DesktopNotificationPreference[]) => {
|
|
if (res?.length > 0) {
|
|
activePreferences.set(res[0])
|
|
} else {
|
|
activePreferences.set(defaultNotificationPreference)
|
|
}
|
|
}
|
|
)
|