move from PHP to VUE, improved Certificate listning
This commit is contained in:
28
UI/client/src/composables/useAppConfig.js
Normal file
28
UI/client/src/composables/useAppConfig.js
Normal file
@@ -0,0 +1,28 @@
|
||||
import { ref } from 'vue';
|
||||
|
||||
const config = ref(null);
|
||||
const isLoaded = ref(false);
|
||||
|
||||
export function useAppConfig() {
|
||||
const loadConfig = async () => {
|
||||
if (isLoaded.value) return;
|
||||
try {
|
||||
const response = await fetch('/config.json');
|
||||
config.value = await response.json();
|
||||
isLoaded.value = true;
|
||||
} catch (error) {
|
||||
console.error('Failed to load configuration:', error);
|
||||
// Fallback or critical error handling
|
||||
config.value = {
|
||||
api_base_url: 'http://localhost:5001/api/v1',
|
||||
refresh_interval: 30000
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
config,
|
||||
isLoaded,
|
||||
loadConfig
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user