improve naming

This commit is contained in:
thierryverse 2025-11-12 13:27:15 +02:00
parent 207a284e9d
commit bd4e5d627d
14 changed files with 90 additions and 54 deletions

View file

@ -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;
}
};