| 387 | } |
| 388 | |
| 389 | async function transferTicket() { |
| 390 | if (data && data.ticket && data.ticket.locked) return; |
| 391 | if (n === undefined) return; |
| 392 | |
| 393 | const res = await fetch(`/api/v1/ticket/transfer`, { |
| 394 | method: "POST", |
| 395 | headers: { |
| 396 | "Content-Type": "application/json", |
| 397 | Authorization: `Bearer ${token}`, |
| 398 | }, |
| 399 | body: JSON.stringify({ |
| 400 | user: n.id, |
| 401 | id, |
| 402 | }), |
| 403 | }).then((res) => res.json()); |
| 404 | |
| 405 | if (!res.success) { |
| 406 | toast({ |
| 407 | variant: "destructive", |
| 408 | title: "Error", |
| 409 | description: res.message || "Failed to transfer ticket", |
| 410 | }); |
| 411 | return; |
| 412 | } |
| 413 | |
| 414 | setAssignedEdit(false); |
| 415 | refetch(); |
| 416 | } |
| 417 | |
| 418 | const handleFileChange = (e: React.ChangeEvent<HTMLInputElement>) => { |
| 419 | if (e.target.files) { |