debian-mirror-gitlab/app/assets/javascripts/work_items/graphql/provider.js

44 lines
1 KiB
JavaScript
Raw Normal View History

2021-12-11 22:18:48 +05:30
import Vue from 'vue';
import VueApollo from 'vue-apollo';
import createDefaultClient from '~/lib/graphql';
import workItemQuery from './work_item.query.graphql';
2022-01-26 12:08:38 +05:30
import { resolvers } from './resolvers';
2021-12-11 22:18:48 +05:30
import typeDefs from './typedefs.graphql';
export function createApolloProvider() {
Vue.use(VueApollo);
2022-01-26 12:08:38 +05:30
const defaultClient = createDefaultClient(resolvers, {
typeDefs,
2022-05-07 20:08:51 +05:30
cacheConfig: {
possibleTypes: {
LocalWorkItemWidget: ['LocalTitleWidget'],
},
},
2022-01-26 12:08:38 +05:30
});
2021-12-11 22:18:48 +05:30
defaultClient.cache.writeQuery({
query: workItemQuery,
variables: {
2022-05-07 20:08:51 +05:30
id: 'gid://gitlab/WorkItem/1',
2021-12-11 22:18:48 +05:30
},
data: {
2022-05-07 20:08:51 +05:30
localWorkItem: {
2022-01-26 12:08:38 +05:30
__typename: 'LocalWorkItem',
2022-05-07 20:08:51 +05:30
id: 'gid://gitlab/WorkItem/1',
2021-12-11 22:18:48 +05:30
type: 'FEATURE',
2022-05-07 20:08:51 +05:30
// eslint-disable-next-line @gitlab/require-i18n-strings
title: 'Test Work Item',
2021-12-11 22:18:48 +05:30
widgets: {
2022-01-26 12:08:38 +05:30
__typename: 'LocalWorkItemWidgetConnection',
2022-05-07 20:08:51 +05:30
nodes: [],
2021-12-11 22:18:48 +05:30
},
},
},
});
return new VueApollo({
defaultClient,
});
}