Clean up model fetching and loading states

This commit is contained in:
Gregory Schier
2025-01-20 13:44:11 -08:00
parent 0453e84d38
commit 8ad7ac0bef
42 changed files with 180 additions and 247 deletions

View File

@@ -1,11 +1,16 @@
import type { Settings } from '@yaakapp-internal/models';
import { useAtomValue } from 'jotai';
import { atom } from 'jotai/index';
import { getSettings } from '../lib/store';
import {jotaiStore} from "../lib/jotai";
import { invokeCmd } from '../lib/tauri';
const settings = await getSettings();
const settings = await invokeCmd<Settings>('cmd_get_settings');
export const settingsAtom = atom<Settings>(settings);
export function useSettings() {
return useAtomValue(settingsAtom);
}
export function getSettings() {
return jotaiStore.get(settingsAtom);
}