refactor: add store to save data from queries progressively

This commit is contained in:
yangsy
2025-08-26 03:27:06 +08:00
parent 55e9efce7e
commit c2ebe34a05
8 changed files with 141 additions and 54 deletions

11
src/stores/line-alarms.ts Normal file
View File

@@ -0,0 +1,11 @@
import type { LineAlarms } from '@/composables/query';
import { defineStore } from 'pinia';
import { ref } from 'vue';
export const useLineAlarmsStore = defineStore('line-alarms', () => {
const lineAlarms = ref<LineAlarms>({});
return {
lineAlarms,
};
});

View File

@@ -0,0 +1,11 @@
import type { LineDevices } from '@/composables/query';
import { defineStore } from 'pinia';
import { ref } from 'vue';
export const useLineDevicesStore = defineStore('ndm-line-devices-store', () => {
const lineDevices = ref<LineDevices>({});
return {
lineDevices,
};
});

View File

@@ -3,14 +3,11 @@ import { defineStore } from 'pinia';
import { computed, ref } from 'vue';
export const useStationStore = defineStore('ndm-station-store', () => {
const updatedTime = ref('');
const stationList = ref<Station[]>([]);
const onlineStationList = computed(() => stationList.value.filter((station) => station.online));
return {
updatedTime,
stationList,
onlineStationList,
};