updateUserById()
updateUserById(
userId:string,data:UpdateUserRequest):Promise<User>
Defined in: packages/core/src/index.ts:552
Update a user by ID (admin only)
Parameters
| Parameter | Type | Description |
|---|---|---|
userId | string | The unique identifier of the user to update |
data | UpdateUserRequest | User data to update (name, email, role, etc.) |
Returns
Promise<User>
The updated user object
Throws
400 - Invalid user data
Throws
401 - Not authenticated
Throws
403 - Admin privileges required
Throws
404 - User not found
Example
import { updateUserById } from "@cpod/sdk";
const updatedUser = await updateUserById("user-123", {
name: "Jane Doe",
role: "admin",
});
console.log(`Updated user: ${updatedUser.name}`);