mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-01 11:56:25 +02:00
update chat api service
This commit is contained in:
parent
b35a5aa589
commit
776660f5e3
5 changed files with 137 additions and 122 deletions
|
|
@ -2,6 +2,7 @@ import { atomWithMutation } from "jotai-tanstack-query";
|
|||
import { toast } from "sonner";
|
||||
import type { Chat } from "@/app/dashboard/[search_space_id]/chats/chats-client";
|
||||
import { deleteChat } from "@/lib/apis/chats.api";
|
||||
import { chatApiService } from "@/lib/apis/chats-api.service";
|
||||
import { cacheKeys } from "@/lib/query-client/cache-keys";
|
||||
import { queryClient } from "@/lib/query-client/client";
|
||||
import { activeSearchSpaceIdAtom } from "../seach-spaces/seach-space-queries.atom";
|
||||
|
|
@ -14,14 +15,7 @@ export const deleteChatMutationAtom = atomWithMutation((get) => {
|
|||
mutationKey: cacheKeys.activeSearchSpace.chats(searchSpaceId ?? ""),
|
||||
enabled: !!searchSpaceId && !!authToken,
|
||||
mutationFn: async (chatId: number) => {
|
||||
if (!authToken) {
|
||||
throw new Error("No authentication token found");
|
||||
}
|
||||
if (!searchSpaceId) {
|
||||
throw new Error("No search space id found");
|
||||
}
|
||||
|
||||
return deleteChat(chatId, authToken);
|
||||
return chatApiService.deleteChat({ id: chatId });
|
||||
},
|
||||
|
||||
onSuccess: (_, chatId) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue