From a0cb231ddbdd7fdced9e7cda771dff7d0833c826 Mon Sep 17 00:00:00 2001 From: Remy Raes Date: Thu, 20 Oct 2022 02:19:26 +0200 Subject: fix: restore updateCurrentTab method with router --- src-vue/src/main.ts | 2 +- src-vue/src/plugins/store.ts | 2 ++ src-vue/src/utils/Tabs.ts | 8 ++++---- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src-vue/src/main.ts b/src-vue/src/main.ts index cd1936b2..dc18b443 100644 --- a/src-vue/src/main.ts +++ b/src-vue/src/main.ts @@ -35,7 +35,7 @@ const routes = [ { path: '/settings', name: 'Settings', component: async () => SettingsView}, { path: '/dev', name: 'Dev', component: async () => DeveloperView} ]; -const router = createRouter({ +export const router = createRouter({ history: createWebHashHistory(), routes, // short for `routes: routes` }); diff --git a/src-vue/src/plugins/store.ts b/src-vue/src/plugins/store.ts index 647ee4e9..a977b38b 100644 --- a/src-vue/src/plugins/store.ts +++ b/src-vue/src/plugins/store.ts @@ -8,6 +8,7 @@ import { ReleaseCanal } from "../utils/ReleaseCanal"; import { ElNotification } from 'element-plus'; import { NorthstarState } from '../utils/NorthstarState'; import { Store } from 'tauri-plugin-store-api'; +import {router} from "../main"; const persistentStore = new Store('flight-core-settings.json'); @@ -65,6 +66,7 @@ export const store = createStore({ }, updateCurrentTab(state: any, newTab: Tabs) { state.current_tab = newTab; + router.push({path: newTab}); }, async launchGame(state: any) { // TODO update installation if release track was switched diff --git a/src-vue/src/utils/Tabs.ts b/src-vue/src/utils/Tabs.ts index 5266da81..48320950 100644 --- a/src-vue/src/utils/Tabs.ts +++ b/src-vue/src/utils/Tabs.ts @@ -1,6 +1,6 @@ export enum Tabs { - PLAY = 'Play', - CHANGELOG = 'Changelog', - SETTINGS = 'Settings', - DEV = 'Dev' + PLAY = '/', + CHANGELOG = '/changelog', + SETTINGS = '/settings', + DEV = '/dev' } -- cgit v1.2.3