Make sure config and version are loaded before app runs to avoid null checks.

This commit is contained in:
baldo 2022-08-24 23:46:56 +02:00
parent 0bbb2113e9
commit dcfaae7955
10 changed files with 38 additions and 31 deletions
frontend/src/stores

View file

@ -11,18 +11,19 @@ function isVersionResponse(arg: unknown): arg is VersionResponse {
}
interface VersionStoreState {
version: Version | null;
version: Version;
}
export const useVersionStore = defineStore({
id: "version",
state(): VersionStoreState {
return {
version: null,
// Initialized in main.ts before mounting app.
version: undefined as unknown as Version,
};
},
getters: {
getVersion(state: VersionStoreState): Version | null {
getVersion(state: VersionStoreState): Version {
return state.version;
},
},