Make sure config and version are loaded before app runs to avoid null checks.
This commit is contained in:
parent
0bbb2113e9
commit
dcfaae7955
10 changed files with 38 additions and 31 deletions
frontend/src/stores
|
@ -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;
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue