diff options
author | Jan <sentrycraft123@gmail.com> | 2023-07-24 13:51:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-24 13:51:34 +0200 |
commit | 44583f739af9db81751655f7391757a28e949239 (patch) | |
tree | a381c8c968833c21a1277052a2d8b605b7ee69c1 /src-vue/src/components/LocalModCard.vue | |
parent | dac7b0b18ab5a36d3a25154108e9acecc6c5fe93 (diff) | |
download | FlightCore-44583f739af9db81751655f7391757a28e949239.tar.gz FlightCore-44583f739af9db81751655f7391757a28e949239.zip |
chore: Store `game_path` and `install_type` as `GameInstall` in store (#445)
We pass the `GameInstall` object to backend on most calls, yet we store the parameters individually in frontend.
This PR resolves that by storing the whole object instead of individual parameters, simplifying a lot of the code that calls the backend.
* chore: Store game_path and install_type as GameInstall in store
* Add missed uses of old attributes
* fix: Update missed attribute in DevView
* fix: Update missed attribute in SettingsView
* refactor: Update functions to use new object
in RepairView
* Initialize game_install as empty object
---------
Co-authored-by: GeckoEidechse <gecko.eidechse+git@pm.me>
Diffstat (limited to 'src-vue/src/components/LocalModCard.vue')
-rw-r--r-- | src-vue/src/components/LocalModCard.vue | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/src-vue/src/components/LocalModCard.vue b/src-vue/src/components/LocalModCard.vue index dd3629f8..f8d0256d 100644 --- a/src-vue/src/components/LocalModCard.vue +++ b/src-vue/src/components/LocalModCard.vue @@ -30,7 +30,6 @@ import { defineComponent } from "vue"; import { invoke } from "@tauri-apps/api"; import { NorthstarMod } from "../../../src-tauri/bindings/NorthstarMod"; -import { GameInstall } from "../utils/GameInstall"; import { showErrorNotification, showNotification } from "../utils/ui"; export default defineComponent({ @@ -50,16 +49,10 @@ export default defineComponent({ async updateWhichModsEnabled(mod: NorthstarMod) { this.global_load_indicator = true; - // Setup up struct - let game_install = { - game_path: this.$store.state.game_path, - install_type: this.$store.state.install_type - } as GameInstall; - // enable/disable specific mod try { await invoke("set_mod_enabled_status", { - gameInstall: game_install, + gameInstall: this.$store.state.game_install, modName: mod.name, // Need to set it to the opposite of current state, // as current state is only updated after command is run @@ -76,11 +69,7 @@ export default defineComponent({ return true; }, async deleteMod(mod: NorthstarMod) { - let game_install = { - game_path: this.$store.state.game_path, - install_type: this.$store.state.install_type - } as GameInstall; - await invoke("delete_northstar_mod", { gameInstall: game_install, nsmodName: mod.name }) + await invoke("delete_northstar_mod", { gameInstall: this.$store.state.game_install, nsmodName: mod.name }) .then((message) => { // Just a visual indicator that it worked showNotification(this.$t('mods.local.success_deleting', { modName: mod.name })); |