mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-09 07:42:39 +02:00
feat: add public chat snapshots components
This commit is contained in:
parent
d890c562d4
commit
ea2dd20a78
5 changed files with 280 additions and 0 deletions
|
|
@ -0,0 +1,17 @@
|
|||
import { atomWithMutation } from "jotai-tanstack-query";
|
||||
import { toast } from "sonner";
|
||||
import type { PublicChatSnapshotDeleteRequest } from "@/contracts/types/chat-threads.types";
|
||||
import { chatThreadsApiService } from "@/lib/apis/chat-threads-api.service";
|
||||
|
||||
export const deletePublicChatSnapshotMutationAtom = atomWithMutation(() => ({
|
||||
mutationFn: async (request: PublicChatSnapshotDeleteRequest) => {
|
||||
return chatThreadsApiService.deletePublicChatSnapshot(request);
|
||||
},
|
||||
onSuccess: () => {
|
||||
toast.success("Public link deleted");
|
||||
},
|
||||
onError: (error: Error) => {
|
||||
console.error("Failed to delete public chat link:", error);
|
||||
toast.error("Failed to delete public link");
|
||||
},
|
||||
}));
|
||||
Loading…
Add table
Add a link
Reference in a new issue