32 lines
743 B
Svelte
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>
|