import type { notesSourceValues } from '@/composables/useNotes' interface Settings { preferredNotesSource: notesSourceValues | null } export const preferredNotesSource = ref(null) const updateSettings = () => { const settings: Settings = { preferredNotesSource: preferredNotesSource.value } localStorage.setItem('settings', JSON.stringify(settings)) } export const initializeSettings = () => { watch([preferredNotesSource], () => updateSettings()) try { const settings: Settings = JSON.parse(localStorage.getItem('settings') || '{}') preferredNotesSource.value = settings.preferredNotesSource } catch (error) { console.error(error) } }