Fix apollo cache issue when registrering first profile

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2021-08-03 14:58:42 +02:00
parent bd71dd6cf1
commit b53d8d54ef
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773

View File

@ -129,6 +129,7 @@ import RouteName from "../../router/name";
import { changeIdentity } from "../../utils/auth"; import { changeIdentity } from "../../utils/auth";
import identityEditionMixin from "../../mixins/identityEdition"; import identityEditionMixin from "../../mixins/identityEdition";
import { ApolloCache, FetchResult } from "@apollo/client/core"; import { ApolloCache, FetchResult } from "@apollo/client/core";
import { ActorType } from "@/types/enums";
@Component({ @Component({
apollo: { apollo: {
@ -180,8 +181,18 @@ export default class Register extends mixins(identityEditionMixin) {
}); });
if (identitiesData && localData) { if (identitiesData && localData) {
identitiesData.identities.push(localData.registerPerson); const newPersonData = {
store.writeQuery({ query: IDENTITIES, data: identitiesData }); ...localData.registerPerson,
type: ActorType.PERSON,
};
store.writeQuery({
query: IDENTITIES,
data: {
...identitiesData,
identities: [...identitiesData.identities, newPersonData],
},
});
} }
} }
}, },