Add user setting to provide location and show events near location on

homepage

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2021-02-12 18:19:49 +01:00
parent 7d8399f4c8
commit b1cc3868a6
27 changed files with 538 additions and 112 deletions

View File

@@ -71,6 +71,7 @@ import { IConfig } from "../../types/config.model";
})
export default class AddressAutoComplete extends Vue {
@Prop({ required: true }) value!: IAddress;
@Prop({ required: false, default: false }) type!: string | false;
addressData: IAddress[] = [];
@@ -118,13 +119,17 @@ export default class AddressAutoComplete extends Vue {
}
this.isFetching = true;
const variables: { query: string; locale: string; type?: string } = {
query,
locale: this.$i18n.locale,
};
if (this.type) {
variables.type = this.type;
}
const result = await this.$apollo.query({
query: ADDRESS,
fetchPolicy: "network-only",
variables: {
query,
locale: this.$i18n.locale,
},
variables,
});
this.addressData = result.data.searchAddress.map(
@@ -144,7 +149,7 @@ export default class AddressAutoComplete extends Vue {
@Watch("value")
updateEditing(): void {
if (!(this.value && this.value.id)) return;
if (!this.value?.id) return;
this.selected = this.value;
const address = new Address(this.selected);
this.queryText = `${address.poiInfos.name} ${address.poiInfos.alternativeName}`;