mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-01-16 22:16:49 +01:00
14 lines
445 B
TypeScript
14 lines
445 B
TypeScript
import type { WebsocketRequest } from '@yaakapp-internal/models';
|
|
import { atom, useAtomValue } from 'jotai';
|
|
import { jotaiStore } from '../lib/jotai';
|
|
|
|
export const websocketRequestsAtom = atom<WebsocketRequest[]>([]);
|
|
|
|
export function useWebsocketRequests() {
|
|
return useAtomValue(websocketRequestsAtom);
|
|
}
|
|
|
|
export function getWebsocketRequest(id: string) {
|
|
return jotaiStore.get(websocketRequestsAtom).find((r) => r.id === id) ?? null;
|
|
}
|