Fix empty layout on initial load

This commit is contained in:
Matthias 2022-04-22 19:35:57 +02:00
parent 4be917852c
commit 8a0b852912

View File

@ -112,5 +112,14 @@ export const useLayoutStore = defineStore('layoutStore', {
}, },
persist: { persist: {
key: STORE_LAYOUTS, key: STORE_LAYOUTS,
afterRestore: (context) => {
console.log('after restore - ', context.store);
if (context.store.dashboardLayout === null) {
context.store.dashboardLayout = JSON.parse(JSON.stringify(DEFAULT_DASHBOARD_LAYOUT));
}
if (context.store.tradingLayout === null) {
context.store.tradingLayout = JSON.parse(JSON.stringify(DEFAULT_TRADING_LAYOUT));
}
},
}, },
}); });