mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-26 19:31:12 +01:00
Websocket Support (#159)
This commit is contained in:
13
src-web/hooks/useWebsocketRequests.ts
Normal file
13
src-web/hooks/useWebsocketRequests.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user