mirror of
https://github.com/MetaFam/TheGame.git
synced 2026-01-23 05:08:01 -05:00
Changed update player username graphql mutation
This commit is contained in:
@@ -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 😢';
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user