| 202 | } |
| 203 | |
| 204 | async function updateTicketStatus(e: any, ticket: any) { |
| 205 | await fetch(`/api/v1/ticket/status/update`, { |
| 206 | method: "PUT", |
| 207 | headers: { |
| 208 | Authorization: `Bearer ${token}`, |
| 209 | "Content-Type": "application/json", |
| 210 | }, |
| 211 | body: JSON.stringify({ id: ticket.id, status: !ticket.isComplete }), |
| 212 | }) |
| 213 | .then((res) => res.json()) |
| 214 | .then(() => { |
| 215 | toast({ |
| 216 | title: ticket.isComplete ? "Issue re-opened" : "Issue closed", |
| 217 | description: "The status of the issue has been updated.", |
| 218 | duration: 3000, |
| 219 | }); |
| 220 | refetch(); |
| 221 | }); |
| 222 | } |
| 223 | |
| 224 | // Add these new functions |
| 225 | async function updateTicketAssignee(ticketId: string, user: any) { |