Removed useless data and fix api req
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
<script lang="ts" setup>
|
||||
import { useCirStore } from "@/stores/cir";
|
||||
import { useCirStore } from "@/stores/repStore";
|
||||
import { useGeolocation } from "@vueuse/core";
|
||||
import { ref } from "vue";
|
||||
|
||||
const { coords } = useGeolocation();
|
||||
const { geoData, getCounty } = useCirStore();
|
||||
const { getRep } = useCirStore();
|
||||
|
||||
const currentCountyCode = ref<string | null>("");
|
||||
const currentRepValue = ref<any>();
|
||||
|
||||
function handleGeolocClick() {
|
||||
currentCountyCode.value = getCounty(
|
||||
async function handleGeolocClick() {
|
||||
currentRepValue.value = await getRep(
|
||||
coords.value.longitude,
|
||||
coords.value.latitude
|
||||
);
|
||||
@@ -20,13 +20,14 @@ function handleGeolocClick() {
|
||||
<div>
|
||||
<main class="container py-4">
|
||||
<button
|
||||
v-if="geoData.isReady"
|
||||
class="py-2 px-4 rounded-sm bg-white text-sm text-slate-950"
|
||||
@click="handleGeolocClick"
|
||||
>
|
||||
Get Code
|
||||
Trouver mon député
|
||||
</button>
|
||||
{{ currentCountyCode }}
|
||||
<pre>
|
||||
{{ currentRepValue }}
|
||||
</pre>
|
||||
</main>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user