mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-26 09:16:22 +02:00
improve naming
This commit is contained in:
parent
207a284e9d
commit
bd4e5d627d
14 changed files with 90 additions and 54 deletions
|
|
@ -54,3 +54,27 @@ export const fetchChatsBySearchSpace = async (
|
|||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export const deleteChat = async (chatId: number, authToken: string) => {
|
||||
try {
|
||||
const response = await fetch(
|
||||
`${process.env.NEXT_PUBLIC_FASTAPI_BACKEND_URL}/api/v1/chats/${chatId}`,
|
||||
{
|
||||
method: "DELETE",
|
||||
headers: {
|
||||
Authorization: `Bearer ${authToken}`,
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`Failed to delete chat: ${response.statusText}`);
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (err) {
|
||||
console.error("Error deleting chat:", err);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue