Use correct mutation and show errors

This commit is contained in:
Chi Vinh Le
2018-01-08 18:52:54 +01:00
parent 615be40b45
commit a40b287226
3 changed files with 40 additions and 5 deletions
@@ -5,6 +5,7 @@ export default {
...createDefaultResponseFragments(
'SetUserRoleResponse',
'ChangeUsernameResponse',
'SetUsernameResponse',
'BanUsersResponse',
'UnbanUserResponse',
'SetUserSuspensionStatusResponse',
@@ -254,6 +254,26 @@ export const withChangeUsername = withMutation(
})
});
export const withSetUsername = withMutation(
gql`
mutation SetUsername($id: ID!, $username: String!) {
setUsername(id: $id, username: $username) {
...SetUsernameResponse
}
}
`, {
props: ({mutate}) => ({
setUsername: (id, username) => {
return mutate({
variables: {
id,
username,
},
});
}
})
});
export const withBanUser = withMutation(
gql`
mutation BanUser($input: BanUserInput!) {