From 708418fe1d94ad83d0d91b601706f11f68c64d16 Mon Sep 17 00:00:00 2001 From: william341 Date: Thu, 29 Apr 2021 15:14:35 -0700 Subject: [PATCH] fix ban button --- .../mutations/planets/toggleBanMutation.ts | 17 +++++++++ .../mutations/users/banUserMutation.ts | 17 +++++++++ src/planet/PlanetContent.tsx | 7 +++- src/profile/Profile.tsx | 35 ++++++++++++++++--- 4 files changed, 71 insertions(+), 5 deletions(-) create mode 100644 src/graphql/mutations/planets/toggleBanMutation.ts create mode 100644 src/graphql/mutations/users/banUserMutation.ts diff --git a/src/graphql/mutations/planets/toggleBanMutation.ts b/src/graphql/mutations/planets/toggleBanMutation.ts new file mode 100644 index 0000000..b825eaf --- /dev/null +++ b/src/graphql/mutations/planets/toggleBanMutation.ts @@ -0,0 +1,17 @@ +import gql from "graphql-tag"; +import IPlanet from "../../../types/IPlanet"; + +export interface IToggleBanMutationData { + toggleBan: IPlanet +} + +const toggleBanMutation = gql` + mutation ToggleBan($planetId: ID!, $userId: ID!) { + toggleBan(planetId: $planetId, userId: $userId) { + id + banned + } + } +`; + +export default toggleBanMutation; \ No newline at end of file diff --git a/src/graphql/mutations/users/banUserMutation.ts b/src/graphql/mutations/users/banUserMutation.ts new file mode 100644 index 0000000..a1ff989 --- /dev/null +++ b/src/graphql/mutations/users/banUserMutation.ts @@ -0,0 +1,17 @@ +import gql from "graphql-tag"; +import IUser from "../../../types/IUser"; + +export interface IBanUserMutationData { + banUser: IUser +} + +const banUserMutation = gql` + mutation BanUser($userId: ID!) { + banUser(userId: $userId) { + id + banned + } + } +`; + +export default banUserMutation; \ No newline at end of file diff --git a/src/planet/PlanetContent.tsx b/src/planet/PlanetContent.tsx index c3379be..f26822a 100644 --- a/src/planet/PlanetContent.tsx +++ b/src/planet/PlanetContent.tsx @@ -113,9 +113,14 @@ function PlanetContent(props: IPlanetContentProps): JSX.Element { {!userLoading && props.planet.owner && permissions.checkFullWritePermission(userData?.currentUser as IUser, props.planet) &&