aboutsummaryrefslogtreecommitdiff
path: root/src-vue/src/plugins
diff options
context:
space:
mode:
authorRemy Raes <raes.remy@gmail.com>2022-09-25 12:39:39 +0200
committerRemy Raes <raes.remy@gmail.com>2022-09-25 12:39:39 +0200
commit634a0581c68e01d7f5155f369e1350010e7f7e91 (patch)
tree25b8075d937d6d1b9a53fbd181c270b420aa79dc /src-vue/src/plugins
parent39a2672580c07eabbed116178d93d20e712a6632 (diff)
downloadFlightCore-634a0581c68e01d7f5155f369e1350010e7f7e91.tar.gz
FlightCore-634a0581c68e01d7f5155f369e1350010e7f7e91.zip
feat: load northstar version in app state
Diffstat (limited to 'src-vue/src/plugins')
-rw-r--r--src-vue/src/plugins/store.ts22
1 files changed, 21 insertions, 1 deletions
diff --git a/src-vue/src/plugins/store.ts b/src-vue/src/plugins/store.ts
index 545f5484..98ad2342 100644
--- a/src-vue/src/plugins/store.ts
+++ b/src-vue/src/plugins/store.ts
@@ -3,6 +3,7 @@ import { listen, Event as TauriEvent } from "@tauri-apps/api/event";
import {Tabs} from "../utils/Tabs";
import {invoke} from "@tauri-apps/api";
import {GameInstall} from "../utils/GameInstall";
+import {ReleaseCanal} from "../utils/ReleaseCanal";
export const store = createStore({
state () {
@@ -11,7 +12,7 @@ export const store = createStore({
developer_mode: false,
game_path: "this/is/the/game/path",
- installed_northstar_version: "1.9.7",
+ installed_northstar_version: "Unknown version",
northstar_is_running: false,
origin_is_running: false
@@ -41,6 +42,9 @@ async function _initializeApp(state: any) {
alert(err);
});
state.game_path = result.game_path;
+
+ // Check installed Northstar version if found
+ await _get_northstar_version_number_and_set_button_accordingly(state);
}
// TODO
@@ -60,3 +64,19 @@ function _initializeListeners(state: any) {
state.northstar_is_running = evt.payload as boolean;
});
}
+
+async function _get_northstar_version_number_and_set_button_accordingly(state: any) {
+ let northstar_version_number: string = await invoke("get_northstar_version_number_caller", { gamePath: state.game_path });
+ if (northstar_version_number && northstar_version_number.length > 0) {
+ state.installed_northstar_version = northstar_version_number;
+
+ await invoke("check_is_northstar_outdated", { gamePath: state.game_path, northstarPackageName: ReleaseCanal.RELEASE })
+ .then((message) => {
+ console.log(message);
+ })
+ .catch((error) => {
+ console.error(error);
+ alert(error);
+ });
+ }
+}