( userId: string, payload: UpdateUserRequest )
| 105 | * Update user information |
| 106 | */ |
| 107 | export async function updateUser( |
| 108 | userId: string, |
| 109 | payload: UpdateUserRequest |
| 110 | ): Promise<User> { |
| 111 | try { |
| 112 | const response = await fetchWithAuth(API_ENDPOINTS.users.update(userId), { |
| 113 | method: "PUT", |
| 114 | body: JSON.stringify(payload), |
| 115 | }); |
| 116 | |
| 117 | const result: UserDetailResponse = await response.json(); |
| 118 | return result.data; |
| 119 | } catch (error) { |
| 120 | if (error instanceof ApiError) { |
| 121 | throw error; |
| 122 | } |
| 123 | throw new ApiError(500, "Failed to update user"); |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | /** |
| 128 | * Delete a user (soft delete) |
no test coverage detected