Fix apollo cache issue when registrering first profile
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
bd71dd6cf1
commit
b53d8d54ef
@ -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],
|
||||||
|
},
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user