nsarrazin HF Staff commited on
Commit
0d0a611
·
1 Parent(s): a68038a

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
- fetch(`${base}/api/conversation/${page.params.id}/message/${message.id}`, {
57
- method: "DELETE",
58
- }).then(async (r) => {
59
- if (r.ok) {
60
- await invalidate(UrlDependency.Conversation);
61
- } else {
62
- $error = (await r.json()).message;
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