mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-10 16:22:38 +02:00
add delete chat mutation
This commit is contained in:
parent
bd4e5d627d
commit
b866170e6a
11 changed files with 486 additions and 445 deletions
|
|
@ -1,23 +0,0 @@
|
|||
import { atomWithQuery } from "jotai-tanstack-query";
|
||||
import { fetchChatsBySearchSpace } from "@/lib/apis/chat-apis";
|
||||
import { activeSearchSpaceIdAtom } from "../../seach-spaces/active-seach-space.atom";
|
||||
|
||||
export const activeSearchSpaceChatsAtom = atomWithQuery((get) => {
|
||||
const searchSpaceId = get(activeSearchSpaceIdAtom);
|
||||
const authToken = localStorage.getItem("surfsense_bearer_token");
|
||||
|
||||
return {
|
||||
queryKey: ["chatsBySearchSpace", searchSpaceId],
|
||||
enabled: !!searchSpaceId && !!authToken,
|
||||
queryFn: async () => {
|
||||
if (!authToken) {
|
||||
throw new Error("No authentication token found");
|
||||
}
|
||||
if (!searchSpaceId) {
|
||||
throw new Error("No search space id found");
|
||||
}
|
||||
|
||||
return fetchChatsBySearchSpace(searchSpaceId, authToken);
|
||||
},
|
||||
};
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue