aboutsummaryrefslogtreecommitdiff
path: root/src-vue/src/plugins
diff options
context:
space:
mode:
authorJan <sentrycraft123@gmail.com>2023-10-06 15:23:31 +0200
committerGitHub <noreply@github.com>2023-10-06 15:23:31 +0200
commited888c8fd4c89df949899a3c0f1be1946ca0523a (patch)
treef1156464eaabaeda9cadbcdc60b315b575c6f8ed /src-vue/src/plugins
parentca6c9c3e9965105624b1cc0a211b6edf986260f8 (diff)
downloadFlightCore-ed888c8fd4c89df949899a3c0f1be1946ca0523a.tar.gz
FlightCore-ed888c8fd4c89df949899a3c0f1be1946ca0523a.zip
fix: Only fetch profiles if a game path is available (#500)
Diffstat (limited to 'src-vue/src/plugins')
-rw-r--r--src-vue/src/plugins/store.ts15
1 files changed, 14 insertions, 1 deletions
diff --git a/src-vue/src/plugins/store.ts b/src-vue/src/plugins/store.ts
index 8f0c3fee..0a3b3e21 100644
--- a/src-vue/src/plugins/store.ts
+++ b/src-vue/src/plugins/store.ts
@@ -61,7 +61,7 @@ export const store = createStore<FlightCoreStore>({
state(): FlightCoreStore {
return {
developer_mode: false,
- game_install: {} as unknown as GameInstall,
+ game_install: {game_path: undefined, profile: undefined, install_type: "UNKNOWN"} as unknown as GameInstall,
available_profiles: [],
@@ -151,8 +151,15 @@ export const store = createStore<FlightCoreStore>({
await persistentStore.set('game-install', { value: state.game_install });
await persistentStore.save(); // explicit save to disk
+ // We can no longer be sure if our last profile is valid, lets reset to be sure
+ state.game_install.profile = "R2Northstar";
+
// Check for Northstar install
store.commit('checkNorthstarUpdates');
+
+ // Since we are in a new game directory, lets see if there are any profiles
+ store.commit('fetchProfiles');
+
}
else {
// Not valid Titanfall2 install
@@ -320,6 +327,12 @@ export const store = createStore<FlightCoreStore>({
);
},
async fetchProfiles(state: FlightCoreStore) {
+ // To fetch profiles we need a valid game path
+ if (!state.game_install.game_path) {
+ return;
+ }
+
+
await invoke("fetch_profiles", { gameInstall: state.game_install })
.then((message) => {
state.available_profiles = message as string[];