diff options
author | Remy Raes <raes.remy@gmail.com> | 2022-10-02 22:35:14 +0200 |
---|---|---|
committer | Remy Raes <raes.remy@gmail.com> | 2022-10-02 22:35:14 +0200 |
commit | 7a5ce8683993d056b68b52bfb9b37d09b7e71d2b (patch) | |
tree | 1c2177e33eecaf49abebff70cd1b674cebdbe06b | |
parent | 22a7bd16852498a95f9733e228e126a644b9c3ed (diff) | |
download | FlightCore-7a5ce8683993d056b68b52bfb9b37d09b7e71d2b.tar.gz FlightCore-7a5ce8683993d056b68b52bfb9b37d09b7e71d2b.zip |
fix: store is now typed
-rw-r--r-- | src-vue/src/components/PlayButton.vue | 5 | ||||
-rw-r--r-- | src-vue/src/plugins/store.ts | 15 | ||||
-rw-r--r-- | src-vue/src/views/DeveloperView.vue | 6 | ||||
-rw-r--r-- | src-vue/src/vuex-shim.d.ts (renamed from src-vue/vuex-shim.d.ts) | 21 |
4 files changed, 30 insertions, 17 deletions
diff --git a/src-vue/src/components/PlayButton.vue b/src-vue/src/components/PlayButton.vue index d3176d87..1b0dbc77 100644 --- a/src-vue/src/components/PlayButton.vue +++ b/src-vue/src/components/PlayButton.vue @@ -1,8 +1,9 @@ <script lang="ts"> +import { defineComponent } from 'vue'; import { NorthstarState } from '../utils/NorthstarState'; import { ReleaseCanal } from '../utils/ReleaseCanal'; -export default { +export default defineComponent({ name: 'PlayButton', computed: { playButtonLabel(): string { @@ -44,7 +45,7 @@ export default { this.$store.commit('launchGame'); } } -}; +}); </script> <template> diff --git a/src-vue/src/plugins/store.ts b/src-vue/src/plugins/store.ts index 67856b47..544d314a 100644 --- a/src-vue/src/plugins/store.ts +++ b/src-vue/src/plugins/store.ts @@ -8,6 +8,21 @@ import {ReleaseCanal} from "../utils/ReleaseCanal"; import { ElNotification } from 'element-plus'; import { NorthstarState } from '../utils/NorthstarState'; + +export type Store = { + current_tab: Tabs, + developer_mode: boolean, + game_path: string, + install_type: InstallType, + + installed_northstar_version: string, + northstar_state: NorthstarState, + release_canal: ReleaseCanal, + + northstar_is_running: boolean, + origin_is_running: boolean +} + export const store = createStore({ state () { return { diff --git a/src-vue/src/views/DeveloperView.vue b/src-vue/src/views/DeveloperView.vue index 8dcc9608..bfb206a2 100644 --- a/src-vue/src/views/DeveloperView.vue +++ b/src-vue/src/views/DeveloperView.vue @@ -7,14 +7,16 @@ </template> <script lang="ts"> -export default { +import {defineComponent} from "vue"; + +export default defineComponent({ name: "DeveloperView", methods: { disableDevMode() { this.$store.commit('toggleDeveloperMode'); } } -} +}); </script> <style scoped> diff --git a/src-vue/vuex-shim.d.ts b/src-vue/src/vuex-shim.d.ts index cebc5ce8..1429115b 100644 --- a/src-vue/vuex-shim.d.ts +++ b/src-vue/src/vuex-shim.d.ts @@ -1,13 +1,8 @@ -import { ComponentCustomProperties } from 'vue' -import { Store } from 'vuex' - -declare module '@vue/runtime-core' { - // Declare your own store states. - interface State { - count: number - } - - interface ComponentCustomProperties { - $store: Store<State> - } -} +import { ComponentCustomProperties } from 'vue'
+import { Store } from 'vuex'
+
+declare module '@vue/runtime-core' {
+ interface ComponentCustomProperties {
+ $store: Store<State>
+ }
+}
|