Removed useless data and fix api req

This commit is contained in:
Alexis
2023-04-27 12:14:33 +02:00
parent 73a4ca7982
commit 3e24dffad6
8 changed files with 20 additions and 2896 deletions

View File

@@ -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>