mirror of
https://github.com/Spythere/srjp-td2.git
synced 2026-05-03 13:38:12 +00:00
restruct: divide logic and layout into components
This commit is contained in:
@@ -1,7 +1,23 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import { useApiStore } from './api.store';
|
||||
import type { ActiveTrain } from '../types/common.types';
|
||||
|
||||
export const useGlobalStore = defineStore('global', {
|
||||
state: () => ({}),
|
||||
getters: {},
|
||||
state: () => ({
|
||||
selectedTrain: null as ActiveTrain | null,
|
||||
|
||||
|
||||
generatedDate: null as Date | null,
|
||||
generatedMs: 0,
|
||||
}),
|
||||
getters: {
|
||||
activeTimetableTrains() {
|
||||
const apiStore = useApiStore();
|
||||
|
||||
if (!apiStore.activeData) return [];
|
||||
|
||||
return apiStore.activeData.trains.filter((train) => train.timetable).sort((t1, t2) => t1.driverName.localeCompare(t2.driverName, 'pl-PL'));
|
||||
},
|
||||
},
|
||||
actions: {},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user