Changed update player username graphql mutation

This commit is contained in:
Alec LaLonde
2021-02-25 15:43:04 -07:00
parent e4c56d0cc5
commit c7111fe3fd
2 changed files with 5 additions and 8 deletions

View File

@@ -31,12 +31,11 @@ export const SetupUsername: React.FC<SetupUsernameProps> = ({username, setUserna
if (!user) return;
const { error } = await updateUsername({
playerId: user.id,
username,
});
if (error) {
// eslint-disable-next-line no-console
console.warn(error);
const errorDescription = error.message.includes('Uniqueness violation')
? 'Username already taken 😢'
: 'The octo is sad 😢';

View File

@@ -1,12 +1,10 @@
import gql from 'fake-tag';
export const UpdateUsernameMutation = gql`
mutation UpdatePlayerUsername($username: String!) {
update_player(_set: { username: $username }, where: {}) {
returning {
id
username
}
mutation UpdatePlayerUsername($playerId: uuid!, $username: String!) {
update_player_by_pk(pk_columns: { id: $playerId }, _set: { username: $username }) {
id
username
}
}
`;