feat: introduce updated mutation system and team.vue rewrite
This commit is contained in:
committed by
liyasthomas
parent
7bb32ecf7e
commit
fb4aab875d
33
packages/hoppscotch-app/helpers/backend/mutations/Team.ts
Normal file
33
packages/hoppscotch-app/helpers/backend/mutations/Team.ts
Normal 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,
|
||||
}
|
||||
)
|
||||
Reference in New Issue
Block a user