Allow logo and accentColor to be set in config/runtimeConfig
This commit is contained in:
parent
6cd47a88c0
commit
61720b8440
9 changed files with 71 additions and 27 deletions
|
|
@ -1,13 +1,14 @@
|
|||
export default {
|
||||
install(Vue, defaultServerFromLocation) {
|
||||
install(Vue, defaultServerFromLocation, onloaded) {
|
||||
var config = Vue.observable(require('@/assets/config.json'));
|
||||
const getRuntimeConfig = async () => {
|
||||
const runtimeConfig = await fetch('./config.json');
|
||||
return await runtimeConfig.json()
|
||||
const getRuntimeConfig = () => {
|
||||
return fetch('./config.json').then((res) => res.json()).catch(err => {
|
||||
console.error("Failed to get config:", err);
|
||||
return {};
|
||||
});
|
||||
}
|
||||
|
||||
config.promise = getRuntimeConfig();
|
||||
config.promise.then(function (json) {
|
||||
config.promise = getRuntimeConfig().then((json) => {
|
||||
// Reactively use all the config values
|
||||
for (const key of Object.keys(json)) {
|
||||
Vue.set(config, key, json[key]);
|
||||
|
|
@ -16,6 +17,12 @@ export default {
|
|||
if (!json.defaultServer) {
|
||||
Vue.set(config, "defaultServer", defaultServerFromLocation);
|
||||
}
|
||||
|
||||
// Tell callback we are done loading runtime config
|
||||
if (onloaded) {
|
||||
onloaded(config);
|
||||
}
|
||||
return config;
|
||||
});
|
||||
Vue.prototype.$config = config;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue