rename storage

This commit is contained in:
2023-09-19 10:47:59 +02:00
parent 51a37342dd
commit e8898f76f0
2 changed files with 11 additions and 3 deletions

View File

@@ -12,7 +12,8 @@ type MarketItemStorage = {
}
const item = ref("");
const itemsStorage = useStorage<MarketItemStorage[]>('market-items', []);
const oldStorage = useStorage<MarketItemStorage[]>('market-items', []); // TODO: remove this after a while
const itemsStorage = useStorage<MarketItemStorage[]>('market-scan-items', []);
const items = ref<MarketResult[]>([]);
const addOrRelaod = async (type: MarketType) => {
const typeID = type.id;
@@ -45,7 +46,14 @@ const addItem = async () => {
watch(items, itms => itemsStorage.value = itms.map(i => ({ typeID: i.type.id, history: i.history })));
onMounted(async () => {
if (itemsStorage.value.length === 0) {
if (oldStorage.value.length > 0) {
itemsStorage.value = oldStorage.value;
oldStorage.value = [];
} else {
return;
}
return;
}

View File

@@ -33,8 +33,8 @@ const props = withDefaults(defineProps<Props>(), {
});
defineEmits<Emits>();
const days = useStorage('market-days', 365);
const threshold = useStorage('market-profit-threshold', 10);
const days = useStorage('market-scan-days', 365);
const threshold = useStorage('market-scan-threshold', 10);
const filter = ref("");
const { sortedArray, headerProps } = useSort<Result>(computed(() => props.items
.filter(r => r.type.name.toLowerCase().includes(filter.value.toLowerCase()))