2021-09-04 01:27:46 +05:30
|
|
|
import produce from 'immer';
|
2021-04-17 20:07:23 +05:30
|
|
|
import VueApollo from 'vue-apollo';
|
2022-01-26 12:08:38 +05:30
|
|
|
import getIssueStateQuery from '~/issues/show/queries/get_issue_state.query.graphql';
|
2021-04-17 20:07:23 +05:30
|
|
|
import createDefaultClient from '~/lib/graphql';
|
2022-08-13 15:12:31 +05:30
|
|
|
import { temporaryConfig, resolvers as workItemResolvers } from '~/work_items/graphql/provider';
|
2021-06-08 01:23:25 +05:30
|
|
|
|
2021-09-04 01:27:46 +05:30
|
|
|
const resolvers = {
|
|
|
|
Mutation: {
|
|
|
|
updateIssueState: (_, { issueType = undefined, isDirty = false }, { cache }) => {
|
|
|
|
const sourceData = cache.readQuery({ query: getIssueStateQuery });
|
|
|
|
const data = produce(sourceData, (draftData) => {
|
|
|
|
draftData.issueState = { issueType, isDirty };
|
|
|
|
});
|
|
|
|
cache.writeQuery({ query: getIssueStateQuery, data });
|
2021-06-08 01:23:25 +05:30
|
|
|
},
|
2022-08-13 15:12:31 +05:30
|
|
|
...workItemResolvers.Mutation,
|
2021-06-08 01:23:25 +05:30
|
|
|
},
|
2021-09-04 01:27:46 +05:30
|
|
|
};
|
|
|
|
|
2022-07-23 23:45:48 +05:30
|
|
|
export const defaultClient = createDefaultClient(
|
|
|
|
resolvers,
|
|
|
|
// should be removed with the rollout of work item assignees FF
|
|
|
|
// https://gitlab.com/gitlab-org/gitlab/-/issues/363030
|
|
|
|
temporaryConfig,
|
|
|
|
);
|
2021-04-17 20:07:23 +05:30
|
|
|
|
|
|
|
export const apolloProvider = new VueApollo({
|
|
|
|
defaultClient,
|
|
|
|
});
|