()
| 13 | const router = useRouter(); |
| 14 | |
| 15 | async function updateUser() { |
| 16 | await fetch(`/api/v1/auth/user/role`, { |
| 17 | method: "PUT", |
| 18 | headers: { |
| 19 | "Content-Type": "application/json", |
| 20 | Authorization: `Bearer ${getCookie("session")}`, |
| 21 | }, |
| 22 | body: JSON.stringify({ |
| 23 | role: admin, |
| 24 | id: user.id, |
| 25 | }), |
| 26 | }) |
| 27 | .then((res) => res.json()) |
| 28 | .then((res) => { |
| 29 | if (res.success === true) { |
| 30 | toast({ |
| 31 | variant: "default", |
| 32 | title: "Success", |
| 33 | description: "User updated succesfully", |
| 34 | }); |
| 35 | } else { |
| 36 | toast({ |
| 37 | variant: "destructive", |
| 38 | title: "Error", |
| 39 | description: res.message, |
| 40 | }); |
| 41 | } |
| 42 | }); |
| 43 | // .then(() => router.reload()); |
| 44 | } |
| 45 | |
| 46 | return ( |
| 47 | <div> |
no test coverage detected