Merge branch 'dev' into main
This commit is contained in:
@@ -1,3 +1,2 @@
|
||||
# maple
|
||||
|
||||
Small app to export and share project structures.
|
||||
# Trouver mon député
|
||||
Application permettant de trouver son député à partir de sa géolocalisation
|
||||
2
env.d.ts
vendored
2
env.d.ts
vendored
@@ -1 +1,3 @@
|
||||
/// <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",
|
||||
"version": "0.0.0",
|
||||
"name": "rep-lookup-fr",
|
||||
"version": "0.1.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "maple",
|
||||
"version": "0.0.0",
|
||||
"name": "rep-lookup-fr",
|
||||
"version": "0.1.0",
|
||||
"dependencies": {
|
||||
"@tailwindcss/typography": "^0.5.4",
|
||||
"@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>
|
||||
<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>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user