diff --git a/src/store/index.ts b/src/store/index.ts index eaca1f9..1afde78 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -131,12 +131,7 @@ export const store = createStore({ const sceneryData = await (await axios.get(sceneryDataQuery)).data; // const sceneryData = await (await axios.get(sceneryDataQuery)).data; - const sceneryData2 = await (await axios.get('http://127.0.0.1:8000/data')).data; - console.log(sceneryData2); - - - - commit(MUTATIONS.SET_SCENERY_DATA, sceneryData2); + commit(MUTATIONS.SET_SCENERY_DATA, sceneryData); commit(MUTATIONS.SET_SCENERY_DATA_STATUS, DataStatus.Loaded); dispatch(ACTIONS.fetchOnlineData); @@ -317,81 +312,35 @@ export const store = createStore({ }, mutations: { - SET_SCENERY_DATA(state, data: SceneryData[]) { + SET_SCENERY_DATA(state, data: any[][]) { // state.sceneryData = [...data]; - console.log('Data:', data); - - state.stationList = data.map(scenery => ({ - stationName: scenery.name, - stationURL: scenery.url, - stationLines: scenery.project_lines, - stationProject: scenery.project_name, - reqLevel: scenery.req_level === undefined ? -1 : scenery.req_level, - supportersOnly: scenery.supporters_only, - signalType: scenery.signal_type, - controlType: scenery.control_type, - SBL: scenery.sbl_routes, - TWB: scenery.twb_routes, - routes: { - oneWay: { - catenary: scenery.track_oneway_e, - noCatenary: scenery.track_oneway_ne - }, - twoWay: { - catenary: scenery.track_twoway_e, - noCatenary: scenery.track_twoway_ne - } - }, - checkpoints: scenery.checkpoints ? scenery.checkpoints.split(";").map(sub => ({ checkpointName: sub, scheduledTrains: [] })) : [], - - default: scenery.is_default, - nonPublic: scenery.is_nonpublic, - unavailable: scenery.is_unavailable, - - stationHash: "", - maxUsers: 0, - currentUsers: 0, - dispatcherName: "", - dispatcherRate: 0, - dispatcherExp: -1, - dispatcherId: 0, - dispatcherIsSupporter: false, - online: false, - statusTimestamp: -3, - statusID: "free", - statusTimeString: "", - stationTrains: [], - scheduledTrains: [], - spawns: [] - })); - - // state.stationList = data.map(station => ({ - // stationName: station[0] as string, - // stationURL: station[1] as string, - // stationLines: station[2] as string, - // stationProject: station[3] as string, - // reqLevel: station[4] as string, - // supportersOnly: station[5] == "TAK", - // signalType: station[6] as string, - // controlType: station[7] as string, - // SBL: station[8] as string, - // TWB: station[9] as string, + // state.stationList = data.map(scenery => ({ + // stationName: scenery.name, + // stationURL: scenery.url, + // stationLines: scenery.project_lines, + // stationProject: scenery.project_name, + // reqLevel: scenery.req_level === undefined ? -1 : scenery.req_level, + // supportersOnly: scenery.supporters_only, + // signalType: scenery.signal_type, + // controlType: scenery.control_type, + // SBL: scenery.sbl_routes, + // TWB: scenery.twb_routes, // routes: { // oneWay: { - // catenary: station[10] as number, - // noCatenary: station[11] as number + // catenary: scenery.track_oneway_e, + // noCatenary: scenery.track_oneway_ne // }, // twoWay: { - // catenary: station[12] as number, - // noCatenary: station[13] as number + // catenary: scenery.track_twoway_e, + // noCatenary: scenery.track_twoway_ne // } // }, - // checkpoints: station[14] ? (station[14] as string).split(";").map(sub => ({ checkpointName: sub, scheduledTrains: [] })) : [], + // checkpoints: scenery.checkpoints ? scenery.checkpoints.split(";").map(sub => ({ checkpointName: sub, scheduledTrains: [] })) : [], - // default: station[15] as boolean, - // nonPublic: station[16] as boolean, - // unavailable: station[17] as boolean, + // default: scenery.is_default, + // nonPublic: scenery.is_nonpublic, + // unavailable: scenery.is_unavailable, // stationHash: "", // maxUsers: 0, @@ -410,6 +359,50 @@ export const store = createStore({ // spawns: [] // })); + state.stationList = data.map(station => ({ + stationName: station[0] as string, + stationURL: station[1] as string, + stationLines: station[2] as string, + stationProject: station[3] as string, + reqLevel: Number(station[4] as string), + supportersOnly: station[5] == "TAK", + signalType: station[6] as string, + controlType: station[7] as string, + SBL: station[8] as string, + TWB: station[9] as string, + routes: { + oneWay: { + catenary: station[10] as number, + noCatenary: station[11] as number + }, + twoWay: { + catenary: station[12] as number, + noCatenary: station[13] as number + } + }, + checkpoints: station[14] ? (station[14] as string).split(";").map(sub => ({ checkpointName: sub, scheduledTrains: [] })) : [], + + default: station[15] as boolean, + nonPublic: station[16] as boolean, + unavailable: station[17] as boolean, + + stationHash: "", + maxUsers: 0, + currentUsers: 0, + dispatcherName: "", + dispatcherRate: 0, + dispatcherExp: -1, + dispatcherId: 0, + dispatcherIsSupporter: false, + online: false, + statusTimestamp: -3, + statusID: "free", + statusTimeString: "", + stationTrains: [], + scheduledTrains: [], + spawns: [] + })); + }, diff --git a/src/views/HistoryView.vue b/src/views/HistoryView.vue index 3e2c575..cb054ec 100644 --- a/src/views/HistoryView.vue +++ b/src/views/HistoryView.vue @@ -25,13 +25,7 @@
-
- Usługa czasowo wyłączona! -
- [Powrót na stronę główną] -
-
- +
@@ -146,7 +140,7 @@ import { DataStatus } from "@/scripts/enums/DataStatus"; const PROD_MODE = true; const API_URL = PROD_MODE - ? "https://stacjownik-api-7xmt4.ondigitalocean.app/api/getTimetables" + ? "https://stacjownik-api-di22o.ondigitalocean.app/api/getTimetables" : "http://localhost:3001/api/getTimetables"; interface APIResponse {