Merge branch 'dev' into main
This commit is contained in:
@@ -1,3 +1,2 @@
|
|||||||
# maple
|
# Trouver mon député
|
||||||
|
Application permettant de trouver son député à partir de sa géolocalisation
|
||||||
Small app to export and share project structures.
|
|
||||||
2
env.d.ts
vendored
2
env.d.ts
vendored
@@ -1 +1,3 @@
|
|||||||
/// <reference types="vite/client" />
|
/// <reference types="vite/client" />
|
||||||
|
declare module "geojson-geometries-lookup";
|
||||||
|
declare module "pako";
|
||||||
|
|||||||
8
package-lock.json
generated
8
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "maple",
|
"name": "rep-lookup-fr",
|
||||||
"version": "0.0.0",
|
"version": "0.1.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "maple",
|
"name": "rep-lookup-fr",
|
||||||
"version": "0.0.0",
|
"version": "0.1.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tailwindcss/typography": "^0.5.4",
|
"@tailwindcss/typography": "^0.5.4",
|
||||||
"@vueuse/core": "^10.1.0",
|
"@vueuse/core": "^10.1.0",
|
||||||
|
|||||||
11
src/stores/repStore.ts
Normal file
11
src/stores/repStore.ts
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import { defineStore } from "pinia";
|
||||||
|
|
||||||
|
export const useCirStore = defineStore("repStore", () => {
|
||||||
|
async function getRep(lon: number, lat: number): Promise<any> {
|
||||||
|
return fetch(`http://localhost:3000/rep?lat=${lat}&lon=${lon}`).then((t) =>
|
||||||
|
t.json()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return { getRep };
|
||||||
|
});
|
||||||
@@ -1,7 +1,33 @@
|
|||||||
<script lang="ts" setup></script>
|
<script lang="ts" setup>
|
||||||
|
import { useCirStore } from "@/stores/repStore";
|
||||||
|
import { useGeolocation } from "@vueuse/core";
|
||||||
|
import { ref } from "vue";
|
||||||
|
|
||||||
|
const { coords } = useGeolocation();
|
||||||
|
const { getRep } = useCirStore();
|
||||||
|
|
||||||
|
const currentRepValue = ref<any>();
|
||||||
|
|
||||||
|
async function handleGeolocClick() {
|
||||||
|
currentRepValue.value = await getRep(
|
||||||
|
coords.value.longitude,
|
||||||
|
coords.value.latitude
|
||||||
|
);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<main class="container py-4">Main</main>
|
<main class="container py-4">
|
||||||
|
<button
|
||||||
|
class="py-2 px-4 rounded-sm bg-white text-sm text-slate-950"
|
||||||
|
@click="handleGeolocClick"
|
||||||
|
>
|
||||||
|
Trouver mon député
|
||||||
|
</button>
|
||||||
|
<pre>
|
||||||
|
{{ currentRepValue }}
|
||||||
|
</pre>
|
||||||
|
</main>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Reference in New Issue
Block a user