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/ThunderstoreModCard.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/ThunderstoreModCard.vue')
-rw-r--r-- | src-vue/src/components/ThunderstoreModCard.vue | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/src-vue/src/components/ThunderstoreModCard.vue b/src-vue/src/components/ThunderstoreModCard.vue index 2fbbac40..30ffbc68 100644 --- a/src-vue/src/components/ThunderstoreModCard.vue +++ b/src-vue/src/components/ThunderstoreModCard.vue @@ -71,7 +71,6 @@ import { ThunderstoreModVersion } from "../../../src-tauri/bindings/Thunderstore import { invoke, shell } from "@tauri-apps/api"; import { ThunderstoreModStatus } from "../utils/thunderstore/ThunderstoreModStatus"; import { NorthstarMod } from "../../../src-tauri/bindings/NorthstarMod"; -import { GameInstall } from "../utils/GameInstall"; import { NorthstarState } from "../utils/NorthstarState"; import { ElMessageBox } from "element-plus"; import { showErrorNotification, showNotification } from "../utils/ui"; @@ -217,12 +216,7 @@ export default defineComponent({ } ) .then(async () => { // Deletion confirmed - let game_install = { - game_path: this.$store.state.game_path, - install_type: this.$store.state.install_type - } as GameInstall; - - await invoke<string>("delete_thunderstore_mod", { gameInstall: game_install, thunderstoreModString: this.latestVersion.full_name }) + await invoke<string>("delete_thunderstore_mod", { gameInstall: this.$store.state.game_install, thunderstoreModString: this.latestVersion.full_name }) .then((message) => { showNotification(this.$t('mods.card.remove_success', { modName: mod.name }), message); }) @@ -239,11 +233,6 @@ export default defineComponent({ }, async installMod(mod: ThunderstoreMod) { - let game_install = { - game_path: this.$store.state.game_path, - install_type: this.$store.state.install_type - } as GameInstall; - // set internal state according to current installation state if (this.modStatus === ThunderstoreModStatus.OUTDATED) { this.isBeingUpdated = true; @@ -254,7 +243,7 @@ export default defineComponent({ // Capture translation method in a context, so it can be used outside Vue component context. // (see https://github.com/R2NorthstarTools/FlightCore/issues/384) (async (translate: Function) => { - await invoke<string>("install_mod_caller", { gameInstall: game_install, thunderstoreModString: this.latestVersion.full_name }).then((message) => { + await invoke<string>("install_mod_caller", { gameInstall: this.$store.state.game_install, thunderstoreModString: this.latestVersion.full_name }).then((message) => { showNotification(translate('mods.card.install_success', { modName: mod.name }), message); }) .catch((error) => { |