salix/back/methods/account/logout.js

26 lines
586 B
JavaScript
Raw Normal View History

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