Upgrade vue-apollo to @vue/apollo-option

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2021-06-11 14:21:27 +02:00
parent 8923319306
commit 13763ba7f9
20 changed files with 80 additions and 53 deletions

View File

@@ -485,7 +485,7 @@ import RouteName from "../../router/name";
import "intersection-observer";
import { CONFIG } from "../../graphql/config";
import { IConfig } from "../../types/config.model";
import { ApolloCache, FetchResult, InMemoryCache } from "@apollo/client/core";
import { ApolloCache, FetchResult } from "@apollo/client/core";
const DEFAULT_LIMIT_NUMBER_OF_PLACES = 10;
@@ -684,11 +684,11 @@ export default class EditEvent extends Vue {
const variables = await this.buildVariables();
try {
const { data } = await this.$apollo.mutate({
const { data } = await this.$apollo.mutate<{ createEvent: IEvent }>({
mutation: CREATE_EVENT,
variables,
update: (
store: ApolloCache<InMemoryCache>,
store: ApolloCache<{ createEvent: IEvent }>,
{ data: updatedData }: FetchResult
) => this.postCreateOrUpdate(store, updatedData?.createEvent),
refetchQueries: ({ data: updatedData }: FetchResult) =>
@@ -719,11 +719,11 @@ export default class EditEvent extends Vue {
const variables = await this.buildVariables();
try {
await this.$apollo.mutate({
await this.$apollo.mutate<{ updateEvent: IEvent }>({
mutation: EDIT_EVENT,
variables,
update: (
store: ApolloCache<InMemoryCache>,
store: ApolloCache<{ updateEvent: IEvent }>,
{ data: updatedData }: FetchResult
) => this.postCreateOrUpdate(store, updatedData?.updateEvent),
refetchQueries: ({ data }: FetchResult) =>

View File

@@ -663,7 +663,7 @@ import EventBanner from "../../components/Event/EventBanner.vue";
import ActorCard from "../../components/Account/ActorCard.vue";
import PopoverActorCard from "../../components/Account/PopoverActorCard.vue";
import { IParticipant } from "../../types/participant.model";
import { ApolloCache, FetchResult, InMemoryCache } from "@apollo/client/core";
import { ApolloCache, FetchResult } from "@apollo/client/core";
// noinspection TypeScriptValidateTypes
@Component({
@@ -1001,7 +1001,12 @@ export default class Event extends EventMixin {
actorId: identity.id,
message,
},
update: (store: ApolloCache<InMemoryCache>, { data }: FetchResult) => {
update: (
store: ApolloCache<{
joinEvent: IParticipant;
}>,
{ data }: FetchResult
) => {
if (data == null) return;
const participationCachedData = store.readQuery<{ person: IPerson }>({