diff --git a/public/js/plugin/FhcApi.js b/public/js/plugin/FhcApi.js index 0c51de53b..fd41eda7d 100644 --- a/public/js/plugin/FhcApi.js +++ b/public/js/plugin/FhcApi.js @@ -136,7 +136,7 @@ export default { return Promise.reject(error); }); - app.config.globalProperties.$fhcApi = { + app.config.globalProperties.$fhcApi = Vue.reactive({ getUri(url) { return fhcApiAxios.getUri({url}); }, @@ -289,7 +289,7 @@ export default { $fhcAlert.alertDefault('error', error.message, message); } } - }; + }); class FhcApiFactoryWrapper { constructor(factorypart, root) { @@ -301,6 +301,11 @@ export default { return (root || this).$fhcApi; } }) + + this.bindKeys(factorypart) + } + + bindKeys(factorypart, root) { Object.keys(factorypart).forEach(key => { Object.defineProperty(this, key, { get() { @@ -316,6 +321,6 @@ export default { const mergedFhcApiFactory = options?.factory ? {...FhcApiFactory, ...options.factory} : FhcApiFactory; app.config.globalProperties.$fhcApi.factory = new FhcApiFactoryWrapper(mergedFhcApiFactory); - app.provide('$fhcApi', app.config.globalProperties.$fhcApi); + app.provide('$fhcApi', app.config.globalProperties.$fhcApi); } }; \ No newline at end of file