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
|
# Do not include metadata nor timestamps in development logs
|
||||||
config :logger, :console, format: "[$level] $message\n", level: :debug
|
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
|
# Set a higher stacktrace during development. Avoid configuring such
|
||||||
# in production as building large stacktraces may be expensive.
|
# in production as building large stacktraces may be expensive.
|
||||||
|
@ -134,9 +134,14 @@ export default class EditIdentity extends Vue {
|
|||||||
|
|
||||||
this.resetFields();
|
this.resetFields();
|
||||||
this.identityName = val;
|
this.identityName = val;
|
||||||
|
const identity = await this.getIdentity();
|
||||||
|
|
||||||
if (this.identityName) {
|
if (!identity) {
|
||||||
this.identity = await this.getIdentity();
|
return await this.$router.push({ name: 'CreateIdentity' });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.identityName && identity) {
|
||||||
|
this.identity = identity;
|
||||||
|
|
||||||
this.avatarFile = await buildFileFromIPicture(this.identity.avatar);
|
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({
|
const result = await this.$apollo.query({
|
||||||
query: FETCH_PERSON,
|
query: FETCH_PERSON,
|
||||||
variables: {
|
variables: {
|
||||||
username: this.identityName,
|
username: this.identityName,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
return new Person(result.data.fetchPerson);
|
return new Person(result.data.fetchPerson);
|
||||||
|
} catch (e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private handleError(err: any) {
|
private handleError(err: any) {
|
||||||
|
Loading…
Reference in New Issue
Block a user