| 223 | |
| 224 | // Add these new functions |
| 225 | async function updateTicketAssignee(ticketId: string, user: any) { |
| 226 | try { |
| 227 | const response = await fetch(`/api/v1/ticket/transfer`, { |
| 228 | method: "POST", |
| 229 | headers: { |
| 230 | "Content-Type": "application/json", |
| 231 | Authorization: `Bearer ${token}`, |
| 232 | }, |
| 233 | body: JSON.stringify({ |
| 234 | user: user ? user.id : undefined, |
| 235 | id: ticketId, |
| 236 | }), |
| 237 | }); |
| 238 | |
| 239 | if (!response.ok) throw new Error("Failed to update assignee"); |
| 240 | |
| 241 | toast({ |
| 242 | title: "Assignee updated", |
| 243 | description: `Transferred issue successfully`, |
| 244 | duration: 3000, |
| 245 | }); |
| 246 | refetch(); |
| 247 | } catch (error) { |
| 248 | toast({ |
| 249 | title: "Error", |
| 250 | description: "Failed to update assignee", |
| 251 | variant: "destructive", |
| 252 | duration: 3000, |
| 253 | }); |
| 254 | } |
| 255 | } |
| 256 | |
| 257 | async function updateTicketPriority(ticket: any, priority: string) { |
| 258 | try { |