diff --git a/src/lib/cards/NearToMeCard.svelte b/src/lib/cards/NearToMeCard.svelte index 8db6be1..dbd5b9c 100644 --- a/src/lib/cards/NearToMeCard.svelte +++ b/src/lib/cards/NearToMeCard.svelte @@ -5,13 +5,14 @@ import type { CardConfig } from "./Card.types"; import type { NearestStationResponse } from "@owlboard/ts-types"; import { uuid } from "$lib/stores/uuid"; - import { location } from "$lib/stores/location"; + import { preferences } from "$lib/stores/preferences"; import InLineLoading from "$lib/navigation/InLineLoading.svelte"; import { apiGet } from "$lib/scripts/apiFetch"; import { onMount } from "svelte"; import { nearToMeCache } from "$lib/stores/nearToMeCache"; import LinkButton from "$lib/buttons/LinkButton.svelte"; import ScriptButton from "$lib/buttons/ScriptButton.svelte"; + import { togglePreference } from "$lib/scripts/preferenceUtil"; let errorMessage: string; let stations: NearestStationResponse[] = []; @@ -26,8 +27,8 @@ refreshing: false, }; - function turnOnLocation() { - location.set(true); + function turnOnLocation(): void { + togglePreference("location", true); getCurrentLocation(); toast.success("Done\nTo disable location, go to settings"); } @@ -49,7 +50,7 @@ } onMount(() => { - if ($location) { + if ($preferences.location) { if (!$uuid || $uuid === "null") { errorMessage = "Register to use this feature"; } else { @@ -70,7 +71,7 @@