From 71e299192e462eef49bd950c79616232ebe1bcc3 Mon Sep 17 00:00:00 2001 From: GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> Date: Tue, 13 Feb 2024 00:29:02 +0100 Subject: refactor: Pass object to backend instead of individual args (#798) Instead of passing individual args to `launch_northstar` in the backend, pass a single object. The idea here being that said object can later easily be extended with more fields such as launch args for Northstar --- src-vue/src/plugins/store.ts | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src-vue/src/plugins/store.ts') diff --git a/src-vue/src/plugins/store.ts b/src-vue/src/plugins/store.ts index a1a67e2b..6c382e0c 100644 --- a/src-vue/src/plugins/store.ts +++ b/src-vue/src/plugins/store.ts @@ -15,6 +15,7 @@ import { router } from "../main"; import { ReleaseInfo } from "../../../src-tauri/bindings/ReleaseInfo"; import { ThunderstoreMod } from "../../../src-tauri/bindings/ThunderstoreMod"; import { NorthstarMod } from "../../../src-tauri/bindings/NorthstarMod"; +import { NorthstarLaunchOptions } from "../../../src-tauri/bindings/NorthstarLaunchOptions" import { searchModule } from './modules/search'; import { i18n } from '../main'; import { pullRequestModule } from './modules/pull_requests'; @@ -173,8 +174,13 @@ export const store = createStore({ } }, async launchGame(state: any, no_checks = false) { - if (no_checks) { - await invoke("launch_northstar", { gameInstall: state.game_install, bypassChecks: no_checks }) + const launch_options: NorthstarLaunchOptions = { + launch_via_steam: false, + bypass_checks: no_checks, + }; + + if (launch_options.bypass_checks) { + await invoke("launch_northstar", { gameInstall: state.game_install, launchOptions: launch_options }) .then((message) => { console.log("Launched with bypassed checks"); console.log(message); @@ -224,7 +230,7 @@ export const store = createStore({ // Game is ready to play. case NorthstarState.READY_TO_PLAY: - await invoke("launch_northstar", { gameInstall: state.game_install }) + await invoke("launch_northstar", { gameInstall: state.game_install, launchOptions: launch_options }) .then((message) => { console.log(message); // NorthstarState.RUNNING @@ -241,7 +247,11 @@ export const store = createStore({ } }, async launchGameSteam(state: any, no_checks = false) { - await invoke("launch_northstar", { gameInstall: state.game_install, launchViaSteam: true, bypassChecks: no_checks }) + const launch_options: NorthstarLaunchOptions = { + launch_via_steam: true, + bypass_checks: false, + }; + await invoke("launch_northstar", { gameInstall: state.game_install, launchOptions: launch_options }) .then((message) => { showNotification('Success'); }) -- cgit v1.2.3