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

26 lines
591 B
JavaScript

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