@mundogamernetwork/shared-ui 1.1.42 → 1.1.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/services/httpService.ts +8 -1
package/package.json
CHANGED
package/services/httpService.ts
CHANGED
|
@@ -100,10 +100,17 @@ export function getHttpService(): AxiosInstance {
|
|
|
100
100
|
return _httpService;
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
|
|
103
|
+
// The target must be a function so the Proxy is callable: callers use BOTH
|
|
104
|
+
// httpService(config) (axios instance invoked as a function) and
|
|
105
|
+
// httpService.get(...). A Proxy over {} only supports property access, so
|
|
106
|
+
// httpService(config) threw "httpService is not a function".
|
|
107
|
+
const httpService = new Proxy(function () {} as unknown as AxiosInstance, {
|
|
104
108
|
get(_target, prop) {
|
|
105
109
|
return (getHttpService() as any)[prop];
|
|
106
110
|
},
|
|
111
|
+
apply(_target, _thisArg, args: any[]) {
|
|
112
|
+
return (getHttpService() as any)(...args);
|
|
113
|
+
},
|
|
107
114
|
});
|
|
108
115
|
|
|
109
116
|
export default httpService;
|