feat: introduce updated mutation system and team.vue rewrite

This commit is contained in:
Andrew Bastin
2021-10-01 15:13:48 +05:30
committed by liyasthomas
parent 7bb32ecf7e
commit fb4aab875d
3 changed files with 152 additions and 47 deletions

View File

@@ -0,0 +1,33 @@
import gql from "graphql-tag"
import { runMutation } from "../GQLClient"
type DeleteTeamErrors =
| "team/not_required_role"
| "team/invalid_id"
| "team/member_not_found"
type ExitTeamErrors = "team/invalid_id" | "team/member_not_found"
export const deleteTeam = (teamID: string) =>
runMutation<void, DeleteTeamErrors>(
gql`
mutation DeleteTeam($teamID: String!) {
deleteTeam(teamID: $teamID)
}
`,
{
teamID,
}
)
export const leaveTeam = (teamID: string) =>
runMutation<void, ExitTeamErrors>(
gql`
mutation ExitTeam($teamID: String!) {
leaveTeam(teamID: $teamID)
}
`,
{
teamID,
}
)