Files
pojazdownik/src/store.ts
T
2022-07-30 16:42:07 +02:00

48 lines
1.1 KiB
TypeScript

import { IStore } from './types';
import { defineStore } from 'pinia';
import { carDataList, isTrainPassenger, locoDataList, maxStockSpeed, totalLength, totalMass } from './utils/vehicleUtils';
export const useStore = defineStore({
id: 'store',
state: () =>
({
chosenCar: null,
chosenLoco: null,
chosenCargo: null,
chosenVehicle: null,
showSupporter: false,
imageLoading: false,
chosenLocoPower: 'loco-e',
chosenCarUseType: 'car-passenger',
stockList: [],
cargoOptions: [],
swapVehicles: false,
chosenStockListIndex: -1,
chosenRealStockName: null,
vehiclePreviewSrc: '',
isRandomizerCardOpen: false,
isRealStockListCardOpen: false,
} as IStore),
getters: {
locoDataList: (state) => locoDataList(state),
carDataList: (state) => carDataList(state),
totalMass: (state) => totalMass(state),
totalLength: (state) => totalLength(state),
maxStockSpeed: (state) => maxStockSpeed(state),
isTrainPassenger: (state) => isTrainPassenger(state),
},
});