geriou-bir/frontend/src/routes/ma_chaeliou/[id]/+page.svelte
2023-09-17 21:16:04 +02:00

32 lines
743 B
Svelte

<script lang="ts">
import { page } from "$app/stores";
import ButtonMain from "$lib/ButtonMain.svelte";
import axios from "$lib/api";
import { onMount } from "svelte";
import type { Grid } from "$lib/types";
import { snakeToCamelCase } from "$lib/case";
let grid: Grid | null;
$: grid = null;
function fetchData() {
try {
axios.get("grids/" + $page.params.id + "/").then((data) => {
grid = snakeToCamelCase(data.data);
});
} catch (e) {
console.log(e);
}
}
onMount(() => {
fetchData();
});
</script>
<main>
{#if grid}
id : {grid.id}, width: {grid.width}, height: {grid.height}
{/if}
</main>