40 lines
1.0 KiB
TypeScript
40 lines
1.0 KiB
TypeScript
|
import { gql, useQuery, useMutation } from '@apollo/client';
|
||
|
import { QUERY_DECISION_SUPPORT_FILES } from '../queries/dsf';
|
||
|
|
||
|
export const MUTATION_CREATE_DECISION_SUPPORT_FILE = gql`
|
||
|
mutation createDecisionSupportFile($changes: DecisionSupportFileChanges!) {
|
||
|
createDecisionSupportFile(changes: $changes) {
|
||
|
id,
|
||
|
title,
|
||
|
status,
|
||
|
sections,
|
||
|
createdAt,
|
||
|
updatedAt
|
||
|
}
|
||
|
}`;
|
||
|
|
||
|
export function useCreateDecisionSupportFileMutation() {
|
||
|
return useMutation(MUTATION_CREATE_DECISION_SUPPORT_FILE, {
|
||
|
refetchQueries: [{query: QUERY_DECISION_SUPPORT_FILES}],
|
||
|
});
|
||
|
}
|
||
|
|
||
|
export const MUTATION_UPDATE_DECISION_SUPPORT_FILE = gql`
|
||
|
mutation updateDecisionSupportFile($id: ID!, $changes: DecisionSupportFileChanges!) {
|
||
|
updateDecisionSupportFile(id: $id, changes: $changes) {
|
||
|
id,
|
||
|
title,
|
||
|
status,
|
||
|
sections,
|
||
|
createdAt,
|
||
|
updatedAt
|
||
|
}
|
||
|
}`;
|
||
|
|
||
|
export function useUpdateDecisionSupportFileMutation() {
|
||
|
return useMutation(MUTATION_UPDATE_DECISION_SUPPORT_FILE, {
|
||
|
refetchQueries: [{
|
||
|
query: QUERY_DECISION_SUPPORT_FILES,
|
||
|
}],
|
||
|
});
|
||
|
}
|