Spaces:
Paused
Paused
feat: add confirm on branch deletion
Browse files
src/lib/components/chat/Alternatives.svelte
CHANGED
|
@@ -53,15 +53,17 @@
|
|
| 53 |
<button
|
| 54 |
class="hidden group-hover/navbranch:block"
|
| 55 |
onclick={() => {
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
|
|
|
|
|
|
| 65 |
}}
|
| 66 |
>
|
| 67 |
<div
|
|
|
|
| 53 |
<button
|
| 54 |
class="hidden group-hover/navbranch:block"
|
| 55 |
onclick={() => {
|
| 56 |
+
if (confirm("Are you sure you want to delete this branch?")) {
|
| 57 |
+
fetch(`${base}/api/conversation/${page.params.id}/message/${message.id}`, {
|
| 58 |
+
method: "DELETE",
|
| 59 |
+
}).then(async (r) => {
|
| 60 |
+
if (r.ok) {
|
| 61 |
+
await invalidate(UrlDependency.Conversation);
|
| 62 |
+
} else {
|
| 63 |
+
$error = (await r.json()).message;
|
| 64 |
+
}
|
| 65 |
+
});
|
| 66 |
+
}
|
| 67 |
}}
|
| 68 |
>
|
| 69 |
<div
|