|
|
@@ -1,6 +1,6 @@
|
|
|
-import { defineStore } from "pinia";
|
|
|
-import { signalAll, selectionAll, switchAll } from '@/api/train'
|
|
|
-import { SignalItem, SelectionItem, SwitchItem } from '@/types/train-travel'
|
|
|
+import {defineStore} from "pinia";
|
|
|
+import {signalAll, selectionAll, switchAll} from '@/api/train'
|
|
|
+import {SignalItem, SelectionItem, SwitchItem} from '@/types/train-travel'
|
|
|
|
|
|
export const StoreTrain = defineStore("train", {
|
|
|
state: () => {
|
|
|
@@ -35,22 +35,22 @@ export const StoreTrain = defineStore("train", {
|
|
|
},
|
|
|
actions: {
|
|
|
updateSignal() {
|
|
|
- signalAll().then(res => {
|
|
|
- if (res.code === 200) {
|
|
|
+ signalAll().then((res: any) => {
|
|
|
+ if (res?.code === 200) {
|
|
|
this.signalList = res.data as SignalItem[];
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
updateSelection() {
|
|
|
- selectionAll().then(res => {
|
|
|
- if (res.code === 200) {
|
|
|
+ selectionAll().then((res: any) => {
|
|
|
+ if (res?.code === 200) {
|
|
|
this.selectionList = res.data as SelectionItem[];
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
updateSwitch() {
|
|
|
- switchAll().then(res => {
|
|
|
- if (res.code === 200) {
|
|
|
+ switchAll().then((res: any) => {
|
|
|
+ if (res?.code === 200) {
|
|
|
this.switchList = res.data as SwitchItem[];
|
|
|
}
|
|
|
})
|