31 lines
856 B
TypeScript
31 lines
856 B
TypeScript
export const useSettingsStore = defineStore(
|
|
'picSettings',
|
|
() => {
|
|
const hideAnswers = ref(true);
|
|
const isSidebarVisible = ref(false);
|
|
// Per-hunt, client-only consent for GPS distance tracking. Off by default;
|
|
// the server cannot prove consent, so this lives only in the client store.
|
|
const trackConsent = ref<Record<number, boolean>>({});
|
|
|
|
function hasTrackConsent(huntId: number): boolean {
|
|
return trackConsent.value[huntId] ?? false;
|
|
}
|
|
|
|
function setTrackConsent(huntId: number, consent: boolean) {
|
|
trackConsent.value[huntId] = consent;
|
|
}
|
|
|
|
return {
|
|
hideAnswers,
|
|
isSidebarVisible,
|
|
trackConsent,
|
|
hasTrackConsent,
|
|
setTrackConsent
|
|
};
|
|
},
|
|
{ persist: true }
|
|
);
|
|
if (import.meta.hot) {
|
|
import.meta.hot.accept(acceptHMRUpdate(useSettingsStore, import.meta.hot));
|
|
}
|