salix/modules/account/back/methods/account/logout.js

24 lines
591 B
JavaScript

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'
},
accessScopes: ['DEFAULT', 'read:multimedia']
});
Self.logout = async ctx => Self.app.models.VnUser.logout(ctx.req.accessToken.id);
};