Disallow accessing identity page when logged in

And disallow calls to fetchPerson when not our own profile or unlogged

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2020-10-02 09:52:47 +02:00
parent beba4a16ea
commit d41aa3b2fd
23 changed files with 1097 additions and 1026 deletions

View File

@@ -161,6 +161,9 @@ import identityEditionMixin from "../../../mixins/identityEdition";
return !this.identityName;
},
update: (data) => new Person(data.fetchPerson),
error({ graphQLErrors }) {
this.handleErrors(graphQLErrors);
},
},
},
})
@@ -321,6 +324,12 @@ export default class EditIdentity extends mixins(identityEditionMixin) {
}
}
handleErrors(errors: any[]): void {
if (errors.some((error) => error.status_code === 401)) {
this.$router.push({ name: RouteName.LOGIN });
}
}
// eslint-disable-next-line class-methods-use-this
get getInstanceHost(): string {
return MOBILIZON_INSTANCE_HOST;