77 lines
1.4 KiB
TypeScript
77 lines
1.4 KiB
TypeScript
|
import { gql, useQuery, useMutation } from '@apollo/client';
|
||
|
|
||
|
const MUTATION_UPDATE_WORKGROUP = gql`
|
||
|
mutation updateWorkgroup($workgroupId: ID!, $changes: WorkgroupChanges!) {
|
||
|
updateWorkgroup(workgroupId: $workgroupId, changes: $changes) {
|
||
|
id,
|
||
|
name,
|
||
|
createdAt,
|
||
|
closedAt,
|
||
|
members {
|
||
|
id,
|
||
|
name,
|
||
|
email
|
||
|
}
|
||
|
}
|
||
|
}`;
|
||
|
|
||
|
export function useUpdateWorkgroupMutation() {
|
||
|
return useMutation(MUTATION_UPDATE_WORKGROUP);
|
||
|
}
|
||
|
|
||
|
const MUTATION_CREATE_WORKGROUP = gql`
|
||
|
mutation createWorkgroup($changes: WorkgroupChanges!) {
|
||
|
createWorkgroup(changes: $changes) {
|
||
|
id,
|
||
|
name,
|
||
|
createdAt,
|
||
|
closedAt,
|
||
|
members {
|
||
|
id,
|
||
|
name,
|
||
|
email
|
||
|
}
|
||
|
}
|
||
|
}`;
|
||
|
|
||
|
export function useCreateWorkgroupMutation() {
|
||
|
return useMutation(MUTATION_CREATE_WORKGROUP);
|
||
|
}
|
||
|
|
||
|
const MUTATION_JOIN_WORKGROUP = gql`
|
||
|
mutation joinWorkgroup($workgroupId: ID!) {
|
||
|
joinWorkgroup(workgroupId: $workgroupId) {
|
||
|
id,
|
||
|
name,
|
||
|
createdAt,
|
||
|
closedAt,
|
||
|
members {
|
||
|
id,
|
||
|
name,
|
||
|
email
|
||
|
}
|
||
|
}
|
||
|
}`;
|
||
|
|
||
|
export function useJoinWorkgroupMutation() {
|
||
|
return useMutation(MUTATION_JOIN_WORKGROUP);
|
||
|
}
|
||
|
|
||
|
const MUTATION_LEAVE_WORKGROUP = gql`
|
||
|
mutation leaveWorkgroup($workgroupId: ID!) {
|
||
|
leaveWorkgroup(workgroupId: $workgroupId) {
|
||
|
id,
|
||
|
name,
|
||
|
createdAt,
|
||
|
closedAt,
|
||
|
members {
|
||
|
id,
|
||
|
name,
|
||
|
email
|
||
|
}
|
||
|
}
|
||
|
}`;
|
||
|
|
||
|
export function useLeaveWorkgroupMutation() {
|
||
|
return useMutation(MUTATION_LEAVE_WORKGROUP);
|
||
|
}
|