correction about issue #1556 : Fix location on homepage and location clearing

This commit is contained in:
Laurent GAY
2024-10-23 16:13:17 +02:00
parent 3ed4105879
commit 9403a9d60a
3 changed files with 20 additions and 2 deletions

View File

@@ -374,7 +374,7 @@ const asyncData = async (query: string): Promise<void> => {
};
const selectedAddressText = computed(() => {
if (!selected) return undefined;
if (!selected || !selected.id) return undefined;
return addressFullName(selected);
});

View File

@@ -27,6 +27,7 @@
:default-text="locationDefaultText"
labelClass="sr-only"
:placeholder="t('e.g. Nantes, Berlin, Cork, …')"
v-on:update:modelValue="modelValueUpdate"
/>
<o-button native-type="submit" icon-left="magnify">
<template v-if="search">{{ t("Go!") }}</template>
@@ -95,6 +96,10 @@ const search = computed({
},
});
const modelValueUpdate = (newlocation: IAddress | null) => {
emit("update:location", newlocation);
};
const submit = () => {
emit("submit");
const { lat, lon } = addressToLocation(location.value);