refactor: add store to save data from queries progressively
This commit is contained in:
11
src/stores/line-alarms.ts
Normal file
11
src/stores/line-alarms.ts
Normal 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,
|
||||
};
|
||||
});
|
||||
11
src/stores/line-devices.ts
Normal file
11
src/stores/line-devices.ts
Normal 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,
|
||||
};
|
||||
});
|
||||
@@ -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,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user