diff --git a/.eslintrc.js b/.eslintrc.js index a87c751..8131582 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -5,6 +5,8 @@ module.exports = { }, extends: [ 'plugin:vue/essential', + 'plugin:vue/strongly-recommended', + 'plugin:vue/recommended', '@vue/standard', '@vue/typescript/recommended', ], diff --git a/public/sw.js b/public/sw.js index c252376..583c670 100644 --- a/public/sw.js +++ b/public/sw.js @@ -17,10 +17,3 @@ registerRoute( cacheName: 'img-mui', }), ) - -registerRoute( - ({ url }) => url.pathname.startsWith('/schemas/'), - new CacheFirst({ - cacheName: 'schemas', - }), -) diff --git a/src/App.vue b/src/App.vue index 237ee24..5019586 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,7 +1,6 @@ @@ -10,35 +9,24 @@ import Vue from 'vue' import '@fontsource/inter/latin-500.css' import '@fontsource/inter/latin-600.css' import '@fontsource/inter/latin-700.css' -import AppHeader from '@/components/AppHeader.vue' -import AppPageView from '@/components/AppPageView.vue' +import AppView from '@/components/AppView.vue' import { lastUpdatedAt, synchronize } from './utils/localstore/synchronizer' export default Vue.extend({ name: 'App', components: { - AppHeader, - AppPageView, - }, - created () { - if (!lastUpdatedAt()) { - synchronize().then(() => { - window.location.href = '/' - }) - } - // Ping server to wake it up - fetch(process.env.VUE_APP_API_URL) + AppView, }, watch: { '$route.params.tab': { handler () { - if (this.$route.params.tab === 'settings') { + if (this.$route.path === '/settings') { return } const tabNumber = Number(this.$route.params.tab) const isValidTabNumber = tabNumber >= 1 && tabNumber <= this.$store.state.tabs.length if (!isValidTabNumber) { - this.$router.push(`/1/${this.$store.state.tabs[0].path}`) + this.$router.push(`/timetables/1/${this.$store.state.tabs[0].path}`) } }, deep: true, @@ -61,7 +49,7 @@ export default Vue.extend({ }, '$store.state.tabs': { handler () { - if (this.$route.params.tab === 'settings') { + if (this.$route.path === '/settings') { return } const tabNumber = Number(this.$route.params.tab) @@ -69,13 +57,20 @@ export default Vue.extend({ if (!isValidTabNumber) { const newTabNumber = Math.min(this.$store.state.tabs.length, Math.max(1, Number(this.$route.params.tab))) const { line, stop } = this.$store.state.tabs[newTabNumber - 1] - this.$router.push(`/${newTabNumber}${line ? `/${line}` : ''}${stop ? `/${stop}` : ''}`) + this.$router.push(`/timetables/${newTabNumber}${line ? `/${line}` : ''}${stop ? `/${stop}` : ''}`) } }, deep: true, immediate: true, }, }, + created () { + if (!lastUpdatedAt()) { + synchronize().then(() => { + window.location.href = '/' + }) + } + }, }) diff --git a/src/components/AppHeader.vue b/src/components/AppHeader.vue index 86b4e33..01ea059 100644 --- a/src/components/AppHeader.vue +++ b/src/components/AppHeader.vue @@ -1,21 +1,32 @@