import { ref, watch } from 'vue'; /** * Kacheln oder Liste – je Seite im Browser gemerkt (@inhaus/ui: useListView). * * const view = useListView('verleih', 'grid'); */ export function useListView(key, fallback = 'grid') { const storageKey = `inhaus:ansicht:${key}`; let initial = fallback; try { const stored = localStorage.getItem(storageKey); if (stored === 'grid' || stored === 'list') initial = stored; } catch { // ohne Speicher: Standard } const view = ref(initial); watch(view, (value) => { try { localStorage.setItem(storageKey, value); } catch { // egal } }); return view; }