fix: add beforeunload listener to game page
This commit is contained in:
parent
67d2358a37
commit
06c0dc8271
1 changed files with 5 additions and 0 deletions
|
@ -2,6 +2,7 @@
|
|||
import type { CheckData, CheckResponse, ClientGameData, MapData } from "$lib/types";
|
||||
import { goto } from "$app/navigation";
|
||||
import { page } from "$app/stores";
|
||||
import { onMount } from "svelte";
|
||||
import L from "leaflet";
|
||||
|
||||
import "leaflet/dist/leaflet.css";
|
||||
|
@ -23,6 +24,10 @@
|
|||
let solutionMarker: L.Marker | null = $state(null);
|
||||
let solutionLine: L.Polyline | null = $state(null);
|
||||
|
||||
onMount(() => {
|
||||
window.addEventListener("beforeunload", (e) => e.preventDefault());
|
||||
});
|
||||
|
||||
async function fetchMap(): Promise<MapData> {
|
||||
return fetch("/api/map?" + $page.url.searchParams).then((r) => r.json());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue