salix/back/methods/vn-user/signOut.js

26 lines
591 B
JavaScript
Raw Normal View History

2019-01-04 12:32:04 +00:00
module.exports = Self => {
Self.remoteMethod('signOut', {
2019-01-04 12:32:04 +00:00
description: 'Logout a user with access token',
accepts: [
{
arg: 'ctx',
type: 'Object',
http: {source: 'context'}
}
],
returns: {
type: 'Boolean',
root: true
},
http: {
path: `/signOut`,
2019-01-04 12:32:04 +00:00
verb: 'POST'
}
});
Self.signOut = async function(ctx) {
await Self.app.models.VnUser.logout(ctx.req.accessToken.id);
2019-01-04 12:32:04 +00:00
return true;
};
};