mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-31 22:43:11 +02:00
Clean up model fetching and loading states
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import type { Environment } from '@yaakapp-internal/models';
|
||||
import { useAtomValue } from 'jotai';
|
||||
import { atom } from 'jotai/index';
|
||||
import { jotaiStore } from '../lib/jotai';
|
||||
|
||||
export const environmentsAtom = atom<Environment[]>([]);
|
||||
|
||||
@@ -23,3 +24,7 @@ export const environmentsBreakdownAtom = atom<{
|
||||
export function useEnvironments() {
|
||||
return useAtomValue(environmentsBreakdownAtom);
|
||||
}
|
||||
|
||||
export function getEnvironment(id: string | null) {
|
||||
return jotaiStore.get(environmentsAtom).find((e) => e.id === id) ?? null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user