diff options
Diffstat (limited to 'src-vue/src/plugins/store.ts')
-rw-r--r-- | src-vue/src/plugins/store.ts | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src-vue/src/plugins/store.ts b/src-vue/src/plugins/store.ts index e18498a6..8f0c3fee 100644 --- a/src-vue/src/plugins/store.ts +++ b/src-vue/src/plugins/store.ts @@ -38,6 +38,7 @@ export interface FlightCoreStore { thunderstoreMods: ThunderstoreMod[], thunderstoreModsCategories: string[], installed_mods: NorthstarMod[], + available_profiles: string[], northstar_is_running: boolean, origin_is_running: boolean, @@ -62,6 +63,8 @@ export const store = createStore<FlightCoreStore>({ developer_mode: false, game_install: {} as unknown as GameInstall, + available_profiles: [], + flightcore_version: "", installed_northstar_version: "", @@ -284,6 +287,9 @@ export const store = createStore<FlightCoreStore>({ return; } + // Clear installed mod list first so we don't end up with leftovers + state.installed_mods = []; + // Call back-end for installed mods await invoke("get_installed_mods_and_properties", { gameInstall: state.game_install }) .then((message) => { @@ -312,6 +318,16 @@ export const store = createStore<FlightCoreStore>({ i18n.global.tc(`channels.names.${state.northstar_release_canal}`), i18n.global.tc('channels.release.switch.text', {canal: state.northstar_release_canal}), ); + }, + async fetchProfiles(state: FlightCoreStore) { + await invoke("fetch_profiles", { gameInstall: state.game_install }) + .then((message) => { + state.available_profiles = message as string[]; + }) + .catch((error) => { + console.error(error); + showErrorNotification(error); + }); } } }); @@ -415,6 +431,8 @@ async function _initializeApp(state: any) { await _get_northstar_version_number(state); } + store.commit('fetchProfiles'); + await invoke<[number, number]>("get_server_player_count") .then((message) => { state.player_count = message[0]; @@ -465,6 +483,8 @@ function _initializeListeners(state: any) { * state, for it to be displayed in UI. */ async function _get_northstar_version_number(state: any) { + state.installed_northstar_version = ""; + await invoke("get_northstar_version_number", { gameInstall: state.game_install }) .then((message) => { let northstar_version_number: string = message as string; |