nodebb-plugin-write-api Updates a user's profile information have Bug?
-
Hello everyone
I have problem, I usenodebb-plugin-write-api
perform user update operations,curl -X PUT -H "Authorization: Bearer d1a81c3f-b0d4-4bc1-a307-dbed9aa5fb3e" --data "username=修改用户名测试" http://localhost:4567/api/v1/users/28
is can't success in mongodb .
Terminal prompt it is{ "code": "ok", "payload": {} }
But my mongod datas was garbage,
Like this ️
mongodb data/* 3146 */ { "_id" : ObjectId("599e70c125bd5e96bac844ad"), "_key" : "user:undefined", "website" : "https://github.com/cdscawd/nodebb-plugin-write-api/blob/master/routes/v2/readme.md", "userslug" : "修改用户名测试", "username" : "修改用户名测试", "email" : "[email protected]", "email:confirmed" : 0, "fullname" : "dsferfer" }
I have UID 28, But why mongod
_key
isuser:undefined
-
This data wasn't update
/* 3132 */ { "_id" : ObjectId("599e6ec025bd5e96bac84286"), "_key" : "user:28", "username" : "gastby", "userslug" : "gastby", "email" : "111111@sd", "joindate" : 1503555264607.0, "lastonline" : 1503555264607.0, "picture" : "", "fullname" : "", "location" : "", "birthday" : "", "website" : "", "signature" : "", "uploadedpicture" : "", "profileviews" : 0, "reputation" : 0, "postcount" : 0, "topiccount" : 0, "lastposttime" : 0, "banned" : 0, "status" : "online", "uid" : 28 }
-
User.updateProfile = function (uid, data, callback) { var fields = ['username', 'email', 'fullname', 'website', 'location', 'groupTitle', 'birthday', 'signature', 'aboutme']; var updateUid = data.uid; var oldData; console.log(uid) //28 console.log(updateUid) //undefined
curl -X PUT -H "Authorization: Bearer d1a81c3f-b0d4-4bc1-a307-dbed9aa5fbe" --data "uid=28&username=修改用户名测试" http://localhost:4567/api/v1/users/28 { "code": "ok", "payload": {} }
"uid=28&username=修改用户名测试"
The problem is solved!(是我的问题还是文档的问题???)@julian
Copyright © 2024 NodeBB | Contributors