2019-01-04 12:32:04 +00:00
|
|
|
module.exports = Self => {
|
2023-01-23 14:24:00 +00:00
|
|
|
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: {
|
2023-01-23 14:24:00 +00:00
|
|
|
path: `/signOut`,
|
2019-01-04 12:32:04 +00:00
|
|
|
verb: 'POST'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2023-01-23 14:24:00 +00:00
|
|
|
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;
|
|
|
|
};
|
|
|
|
};
|