remember last used config on reload

This commit is contained in:
Tako 2023-06-09 19:32:47 +00:00
parent 5ada9e5a0b
commit 3cb7d75601
2 changed files with 4 additions and 5 deletions

View File

@ -154,7 +154,7 @@ onMounted(async () => {
: 1,
);
pairlistStore.selectOrCreateConfig(
pairlistStore.savedConfigs.length > 0 ? pairlistStore.savedConfigs[0].name : 'default',
pairlistStore.isSavedConfig(pairlistStore.configName) ? pairlistStore.configName : 'default',
);
});

View File

@ -55,9 +55,8 @@ export const usePairlistConfigStore = defineStore(
return JSON.stringify(configToPayloadItems(), null, 2);
});
const isSavedConfig = computed(
() => savedConfigs.value.findIndex((c) => c.name === config.value.name) > -1,
);
const isSavedConfig = (name: string) =>
savedConfigs.value.findIndex((c) => c.name === name) > -1;
function addToConfig(pairlist: Pairlist, index: number) {
pairlist = structuredClone(toRaw(pairlist));
@ -249,7 +248,7 @@ export const usePairlistConfigStore = defineStore(
{
persist: {
key: 'ftPairlistConfig',
paths: ['savedConfigs'],
paths: ['savedConfigs', 'configName'],
},
},
);