mirror of
https://github.com/wassname/talk.git
synced 2026-07-05 08:14:56 +08:00
27 lines
635 B
JavaScript
27 lines
635 B
JavaScript
const UsersService = require('../../services/users');
|
|
|
|
const setUserStatus = ({user}, {id, status}) => {
|
|
return UsersService.setStatus(id, status)
|
|
.then(res => res);
|
|
};
|
|
|
|
module.exports = (context) => {
|
|
|
|
// TODO: refactor to something that'll return an error in the event an attempt
|
|
// is made to mutate state while not logged in. There's got to be a better way
|
|
// to do this.
|
|
if (context.user && context.user.can('mutation:setUserStatus')) {
|
|
return {
|
|
User: {
|
|
setUserStatus: (action) => setUserStatus(context, action)
|
|
}
|
|
};
|
|
}
|
|
|
|
return {
|
|
User: {
|
|
setUserStatus: () => {},
|
|
}
|
|
};
|
|
};
|