mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-27 17:56:25 +02:00
feat: add public chat frontend
This commit is contained in:
parent
9d7259aab9
commit
37adc54d6a
9 changed files with 415 additions and 1 deletions
14
surfsense_web/hooks/use-public-chat.ts
Normal file
14
surfsense_web/hooks/use-public-chat.ts
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import { useQuery } from "@tanstack/react-query";
|
||||
import type { GetPublicChatResponse } from "@/contracts/types/public-chat.types";
|
||||
import { publicChatApiService } from "@/lib/apis/public-chat-api.service";
|
||||
import { cacheKeys } from "@/lib/query-client/cache-keys";
|
||||
|
||||
export function usePublicChat(shareToken: string) {
|
||||
return useQuery<GetPublicChatResponse, Error>({
|
||||
queryKey: cacheKeys.publicChat.byToken(shareToken),
|
||||
queryFn: () => publicChatApiService.getPublicChat({ share_token: shareToken }),
|
||||
enabled: !!shareToken,
|
||||
staleTime: 30_000,
|
||||
retry: false,
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue