no direct binding to local storage

This commit is contained in:
Norman Köhring 2023-03-11 20:49:00 +01:00
parent 72a7ee8c95
commit 94f34e56d1

View file

@ -21,13 +21,15 @@ export default function useStarsyStorage(star, objects) {
const currentName = ref('example')
function loadPreset(name) {
return store.value[name]
const jsonClone = JSON.stringify(store.value[name])
const preset = JSON.parse(jsonClone)
return preset
}
function savePreset(star, objects) {
const name = currentName.value
store.value[name] = { star, objects }
console.log('saved preset', name, store.value[name])
const jsonClone = JSON.stringify({ star, objects})
store.value[name] = JSON.parse(jsonClone)
}
function deletePreset(name) {