rename storage
This commit is contained in:
@@ -12,7 +12,8 @@ type MarketItemStorage = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const item = ref("");
|
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 items = ref<MarketResult[]>([]);
|
||||||
const addOrRelaod = async (type: MarketType) => {
|
const addOrRelaod = async (type: MarketType) => {
|
||||||
const typeID = type.id;
|
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 })));
|
watch(items, itms => itemsStorage.value = itms.map(i => ({ typeID: i.type.id, history: i.history })));
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
|
||||||
if (itemsStorage.value.length === 0) {
|
if (itemsStorage.value.length === 0) {
|
||||||
|
if (oldStorage.value.length > 0) {
|
||||||
|
itemsStorage.value = oldStorage.value;
|
||||||
|
oldStorage.value = [];
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ const props = withDefaults(defineProps<Props>(), {
|
|||||||
});
|
});
|
||||||
defineEmits<Emits>();
|
defineEmits<Emits>();
|
||||||
|
|
||||||
const days = useStorage('market-days', 365);
|
const days = useStorage('market-scan-days', 365);
|
||||||
const threshold = useStorage('market-profit-threshold', 10);
|
const threshold = useStorage('market-scan-threshold', 10);
|
||||||
const filter = ref("");
|
const filter = ref("");
|
||||||
const { sortedArray, headerProps } = useSort<Result>(computed(() => props.items
|
const { sortedArray, headerProps } = useSort<Result>(computed(() => props.items
|
||||||
.filter(r => r.type.name.toLowerCase().includes(filter.value.toLowerCase()))
|
.filter(r => r.type.name.toLowerCase().includes(filter.value.toLowerCase()))
|
||||||
|
|||||||
Reference in New Issue
Block a user