Files
yaak/src-web/hooks/useHttpRequests.ts
2025-01-20 13:44:11 -08:00

14 lines
406 B
TypeScript

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);
}
export function getHttpRequest(id: string) {
return jotaiStore.get(httpRequestsAtom).find(r => r.id === id) ?? null;
}