forked from potsda.mn/mobilizon
Handle update identity with bad identity username
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
f91f8ab926
commit
08dab070e7
|
@ -52,7 +52,7 @@ config :mobilizon, MobilizonWeb.Endpoint,
|
|||
# Do not include metadata nor timestamps in development logs
|
||||
config :logger, :console, format: "[$level] $message\n", level: :debug
|
||||
|
||||
config :mobilizon, Mobilizon.Service.Geospatial, service: Mobilizon.Service.Geospatial.Nominatim
|
||||
config :mobilizon, Mobilizon.Service.Geospatial, service: Mobilizon.Service.Geospatial.GoogleMaps
|
||||
|
||||
# Set a higher stacktrace during development. Avoid configuring such
|
||||
# in production as building large stacktraces may be expensive.
|
||||
|
|
|
@ -134,9 +134,14 @@ export default class EditIdentity extends Vue {
|
|||
|
||||
this.resetFields();
|
||||
this.identityName = val;
|
||||
const identity = await this.getIdentity();
|
||||
|
||||
if (this.identityName) {
|
||||
this.identity = await this.getIdentity();
|
||||
if (!identity) {
|
||||
return await this.$router.push({ name: 'CreateIdentity' });
|
||||
}
|
||||
|
||||
if (this.identityName && identity) {
|
||||
this.identity = identity;
|
||||
|
||||
this.avatarFile = await buildFileFromIPicture(this.identity.avatar);
|
||||
}
|
||||
|
@ -280,15 +285,18 @@ export default class EditIdentity extends Vue {
|
|||
});
|
||||
}
|
||||
|
||||
private async getIdentity() {
|
||||
private async getIdentity(): Promise<Person|null> {
|
||||
try {
|
||||
const result = await this.$apollo.query({
|
||||
query: FETCH_PERSON,
|
||||
variables: {
|
||||
username: this.identityName,
|
||||
},
|
||||
});
|
||||
|
||||
return new Person(result.data.fetchPerson);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private handleError(err: any) {
|
||||
|
|
Loading…
Reference in a new issue