aboutsummaryrefslogtreecommitdiff
path: root/src-vue/src/plugins/store.ts
diff options
context:
space:
mode:
authorJan <sentrycraft123@gmail.com>2023-08-08 23:59:05 +0200
committerGitHub <noreply@github.com>2023-08-08 23:59:05 +0200
commit24fb67f88ceca9bec04b49fae5b58759b7b25ec5 (patch)
tree3f30f87435b2877302bb90bd4ac1d82238230aa4 /src-vue/src/plugins/store.ts
parent023d2310ca33c5869f57bb4d68999662c6d887a9 (diff)
downloadFlightCore-24fb67f88ceca9bec04b49fae5b58759b7b25ec5.tar.gz
FlightCore-24fb67f88ceca9bec04b49fae5b58759b7b25ec5.zip
feat: Add dropdown menu for profiles (#494)
Adds a dropdown menu to settings that allows selecting a different profile. Currently gated behind dev mode being active.
Diffstat (limited to 'src-vue/src/plugins/store.ts')
-rw-r--r--src-vue/src/plugins/store.ts20
1 files changed, 20 insertions, 0 deletions
diff --git a/src-vue/src/plugins/store.ts b/src-vue/src/plugins/store.ts
index e18498a6..8f0c3fee 100644
--- a/src-vue/src/plugins/store.ts
+++ b/src-vue/src/plugins/store.ts
@@ -38,6 +38,7 @@ export interface FlightCoreStore {
thunderstoreMods: ThunderstoreMod[],
thunderstoreModsCategories: string[],
installed_mods: NorthstarMod[],
+ available_profiles: string[],
northstar_is_running: boolean,
origin_is_running: boolean,
@@ -62,6 +63,8 @@ export const store = createStore<FlightCoreStore>({
developer_mode: false,
game_install: {} as unknown as GameInstall,
+ available_profiles: [],
+
flightcore_version: "",
installed_northstar_version: "",
@@ -284,6 +287,9 @@ export const store = createStore<FlightCoreStore>({
return;
}
+ // Clear installed mod list first so we don't end up with leftovers
+ state.installed_mods = [];
+
// Call back-end for installed mods
await invoke("get_installed_mods_and_properties", { gameInstall: state.game_install })
.then((message) => {
@@ -312,6 +318,16 @@ export const store = createStore<FlightCoreStore>({
i18n.global.tc(`channels.names.${state.northstar_release_canal}`),
i18n.global.tc('channels.release.switch.text', {canal: state.northstar_release_canal}),
);
+ },
+ async fetchProfiles(state: FlightCoreStore) {
+ await invoke("fetch_profiles", { gameInstall: state.game_install })
+ .then((message) => {
+ state.available_profiles = message as string[];
+ })
+ .catch((error) => {
+ console.error(error);
+ showErrorNotification(error);
+ });
}
}
});
@@ -415,6 +431,8 @@ async function _initializeApp(state: any) {
await _get_northstar_version_number(state);
}
+ store.commit('fetchProfiles');
+
await invoke<[number, number]>("get_server_player_count")
.then((message) => {
state.player_count = message[0];
@@ -465,6 +483,8 @@ function _initializeListeners(state: any) {
* state, for it to be displayed in UI.
*/
async function _get_northstar_version_number(state: any) {
+ state.installed_northstar_version = "";
+
await invoke("get_northstar_version_number", { gameInstall: state.game_install })
.then((message) => {
let northstar_version_number: string = message as string;