| 311 | } |
| 312 | |
| 313 | async function deleteComment(id: string) { |
| 314 | await fetch(`/api/v1/ticket/comment/delete`, { |
| 315 | method: "POST", |
| 316 | headers: { |
| 317 | "Content-Type": "application/json", |
| 318 | Authorization: `Bearer ${token}`, |
| 319 | }, |
| 320 | body: JSON.stringify({ id }), |
| 321 | }) |
| 322 | .then((res) => res.json()) |
| 323 | .then((res) => { |
| 324 | if (res.success) { |
| 325 | refetch(); |
| 326 | } else { |
| 327 | toast({ |
| 328 | variant: "destructive", |
| 329 | title: "Error", |
| 330 | description: "Failed to delete comment", |
| 331 | }); |
| 332 | } |
| 333 | }); |
| 334 | } |
| 335 | |
| 336 | async function addTime() { |
| 337 | if (data && data.ticket && data.ticket.locked) return; |