feat: add me
This commit is contained in:
@@ -67,7 +67,7 @@ app
|
||||
middleware: ['auth'],
|
||||
})
|
||||
.define(async (ctx) => {
|
||||
const { username, password, description } = ctx.query;
|
||||
const { username, password, description, avatar, email } = ctx.query.data || {};
|
||||
const state = ctx.state?.tokenUser || {};
|
||||
const { id } = state;
|
||||
const user = await User.findByPk(id);
|
||||
@@ -83,6 +83,12 @@ app
|
||||
if (description) {
|
||||
user.description = description;
|
||||
}
|
||||
if (avatar) {
|
||||
user.avatar = avatar;
|
||||
}
|
||||
if (email) {
|
||||
user.email = email;
|
||||
}
|
||||
await user.save();
|
||||
ctx.body = await user.getInfo();
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user