mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-27 09:46:25 +02:00
refactor: rename snapshot types to PublicChatSnapshot prefix
This commit is contained in:
parent
e62e4faaa5
commit
d890c562d4
9 changed files with 95 additions and 91 deletions
|
|
@ -1,17 +1,16 @@
|
|||
import { atomWithMutation } from "jotai-tanstack-query";
|
||||
import { toast } from "sonner";
|
||||
import type {
|
||||
CreateSnapshotRequest,
|
||||
CreateSnapshotResponse,
|
||||
PublicChatSnapshotCreateRequest,
|
||||
PublicChatSnapshotCreateResponse,
|
||||
} from "@/contracts/types/chat-threads.types";
|
||||
import { chatThreadsApiService } from "@/lib/apis/chat-threads-api.service";
|
||||
|
||||
export const createSnapshotMutationAtom = atomWithMutation(() => ({
|
||||
mutationFn: async (request: CreateSnapshotRequest) => {
|
||||
return chatThreadsApiService.createSnapshot(request);
|
||||
export const createPublicChatSnapshotMutationAtom = atomWithMutation(() => ({
|
||||
mutationFn: async (request: PublicChatSnapshotCreateRequest) => {
|
||||
return chatThreadsApiService.createPublicChatSnapshot(request);
|
||||
},
|
||||
onSuccess: (response: CreateSnapshotResponse) => {
|
||||
// Construct URL using frontend origin (backend returns its own URL which differs)
|
||||
onSuccess: (response: PublicChatSnapshotCreateResponse) => {
|
||||
const publicUrl = `${window.location.origin}/public/${response.share_token}`;
|
||||
navigator.clipboard.writeText(publicUrl);
|
||||
if (response.is_new) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue