mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 13:28:11 +00:00
Zmiana instancji store'a na Pinia
This commit is contained in:
@@ -50,13 +50,12 @@ import SceneryHeader from '@/components/SceneryView/SceneryHeader.vue';
|
||||
import ActionButton from '@/components/Global/ActionButton.vue';
|
||||
|
||||
import { computed, ComputedRef, defineComponent, provide, reactive } from '@vue/runtime-core';
|
||||
import { useStore } from '@/store';
|
||||
import { GETTERS } from '@/constants/storeConstants';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
import axios from 'axios';
|
||||
import { URLs } from '@/scripts/utils/apiURLs';
|
||||
import Station from '@/scripts/interfaces/Station';
|
||||
import { useStore } from '@/store/store';
|
||||
|
||||
export default defineComponent({
|
||||
components: { SceneryInfo, SceneryTimetable, SceneryHistory, ActionButton, SceneryHeader },
|
||||
@@ -79,16 +78,13 @@ export default defineComponent({
|
||||
const store = useStore();
|
||||
|
||||
const savedSceneryHistory = reactive({});
|
||||
const data: ComputedRef<StoreData> = computed(() => store.getters[GETTERS.allData]);
|
||||
|
||||
const timetableOnly = computed(() => (route.query['timetable_only'] == '1' ? true : false));
|
||||
|
||||
const isComponentVisible = computed(() => route.path === '/scenery');
|
||||
|
||||
const stationInfo = computed(() => {
|
||||
return data.value.stationList.find(
|
||||
(station) => station.name === route.query.station?.toString().replace(/_/g, ' ')
|
||||
);
|
||||
return store.stationList.find((station) => station.name === route.query.station?.toString().replace(/_/g, ' '));
|
||||
});
|
||||
|
||||
provide('savedSceneryHistory', savedSceneryHistory);
|
||||
@@ -98,8 +94,7 @@ export default defineComponent({
|
||||
// });
|
||||
|
||||
return {
|
||||
data,
|
||||
currentRegion: computed(() => store.getters[GETTERS.currentRegion]),
|
||||
currentRegion: store.region,
|
||||
timetableOnly,
|
||||
isComponentVisible,
|
||||
stationInfo,
|
||||
@@ -119,10 +114,6 @@ export default defineComponent({
|
||||
},
|
||||
},
|
||||
|
||||
async mounted() {
|
||||
// this.stationInfo = (this.$store.getters[GETTERS.allData] as StoreData).stationList.find((station) => station.name === this.$route.query.station?.toString().replace(/_/g, ' '))
|
||||
},
|
||||
|
||||
async activated() {
|
||||
if (this.currentRegion.id != 'eu' && this.viewMode == 'history') this.viewMode = 'info';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user