Update the user's profile information
The JWT token in the 'jwt' cookie is verified by the verifyJWT middleware. If valid, the user's ID is extracted from the token and added to request.body.userId. The updateProfile controller then updates the user's profile information and returns the updated user data.
PATCH
/api/profile/updateprofile
curl \
--request PATCH 'http://localhost:xxxx/api/profile/updateprofile' \
--cookie "jwt=$API_KEY" \
--header "Content-Type: application/json" \
--data '{"firstName":"约翰","lastName":"多伊","theme":1}'
Request examples
{
"firstName": "约翰",
"lastName": "多伊",
"theme": 1
}
Response examples (200)
{
"user": {
"id": "60d0fe4f5311236168a109ca",
"email": "user@example.com",
"configuredProfile": true,
"firstName": "约翰",
"lastName": "多伊",
"avatar": "https://example.com/avatar.jpg",
"theme": 1
}
}
Response examples (400)
名字、姓氏和主题均为必填项
Response examples (401)
您未通过身份验证
Response examples (403)
无效的令牌
Response examples (404)
错误
Response examples (500)
服务器内部错误