| 260 | } |
| 261 | |
| 262 | async function deleteIssue(locked) { |
| 263 | await fetch(`/api/v1/ticket/delete`, { |
| 264 | method: "POST", |
| 265 | headers: { |
| 266 | "Content-Type": "application/json", |
| 267 | Authorization: `Bearer ${token}`, |
| 268 | }, |
| 269 | body: JSON.stringify({ |
| 270 | id, |
| 271 | }), |
| 272 | }) |
| 273 | .then((res) => res.json()) |
| 274 | .then((res) => { |
| 275 | if (res.success) { |
| 276 | toast({ |
| 277 | variant: "default", |
| 278 | title: "Issue Deleted", |
| 279 | description: "The issue has been deleted", |
| 280 | }); |
| 281 | router.push("/issues"); |
| 282 | } |
| 283 | }); |
| 284 | } |
| 285 | |
| 286 | async function addComment() { |
| 287 | if (data && data.ticket && data.ticket.locked) return; |