mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-21 00:49:17 +01:00
Clean up model fetching and loading states
This commit is contained in:
@@ -1,8 +1,13 @@
|
||||
import type { HttpRequest } from '@yaakapp-internal/models';
|
||||
import { atom, useAtomValue } from 'jotai';
|
||||
import type {HttpRequest} from '@yaakapp-internal/models';
|
||||
import {atom, useAtomValue} from 'jotai';
|
||||
import {jotaiStore} from "../lib/jotai";
|
||||
|
||||
export const httpRequestsAtom = atom<HttpRequest[]>([]);
|
||||
|
||||
export function useHttpRequests() {
|
||||
return useAtomValue(httpRequestsAtom);
|
||||
return useAtomValue(httpRequestsAtom);
|
||||
}
|
||||
|
||||
export function getHttpRequest(id: string) {
|
||||
return jotaiStore.get(httpRequestsAtom).find(r => r.id === id) ?? null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user