Implement delete chat with confirmation dialog
This commit is contained in:
@@ -39,6 +39,22 @@ class ChatService {
|
||||
}
|
||||
}
|
||||
|
||||
async deleteChat(chatId) {
|
||||
try {
|
||||
const response = await fetch(`/api/v1/conversations/${chatId}`, {
|
||||
method: "DELETE",
|
||||
})
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! status: ${response.status}`)
|
||||
}
|
||||
return true
|
||||
} catch (error) {
|
||||
console.error("Error removing chat:", error)
|
||||
toast.error("Could not removing chat")
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
async getChatMessages(chatId) {
|
||||
try {
|
||||
const response = await fetch(`/api/v1/conversations/${chatId}/messages`)
|
||||
|
||||
Reference in New Issue
Block a user