Display config values in header and footer.
This commit is contained in:
parent
59f7897d8e
commit
fde340ead0
13 changed files with 344 additions and 80 deletions
29
frontend/src/stores/config.ts
Normal file
29
frontend/src/stores/config.ts
Normal file
|
@ -0,0 +1,29 @@
|
|||
import {defineStore} from "pinia";
|
||||
import {type ClientConfig, isClientConfig} from "@/types";
|
||||
import {api} from "@/utils/Api";
|
||||
|
||||
interface ConfigStoreState {
|
||||
config: ClientConfig | null;
|
||||
}
|
||||
|
||||
export const useConfigStore = defineStore({
|
||||
id: "config",
|
||||
state(): ConfigStoreState {
|
||||
return {
|
||||
config: null,
|
||||
};
|
||||
},
|
||||
getters: {
|
||||
getConfig(state: ConfigStoreState): ClientConfig | null {
|
||||
return state.config;
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
async refresh(): Promise<void> {
|
||||
this.config = await api.get<ClientConfig>(
|
||||
"config",
|
||||
isClientConfig
|
||||
);
|
||||
},
|
||||
},
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue