@teamkeel/client-react 0.364.3 → 0.365.1
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/src/index.tsx +6 -6
package/package.json
CHANGED
package/src/index.tsx
CHANGED
|
@@ -13,9 +13,9 @@ interface KeelProviderProps<
|
|
|
13
13
|
U = Omit<ConstructorParameters<T>[0], "endpoint">
|
|
14
14
|
> {
|
|
15
15
|
/**
|
|
16
|
-
* The
|
|
16
|
+
* The base URL for the client.
|
|
17
17
|
*/
|
|
18
|
-
|
|
18
|
+
baseUrl: string;
|
|
19
19
|
/**
|
|
20
20
|
* Additional config options for the client.
|
|
21
21
|
*/
|
|
@@ -25,7 +25,7 @@ interface KeelProviderProps<
|
|
|
25
25
|
|
|
26
26
|
export const keel = <T extends new (...args: any[]) => any>(Client: T) => {
|
|
27
27
|
function KeelProvider<T extends new (...args: any[]) => any>({
|
|
28
|
-
|
|
28
|
+
baseUrl,
|
|
29
29
|
config,
|
|
30
30
|
children,
|
|
31
31
|
}: KeelProviderProps<T>) {
|
|
@@ -34,14 +34,14 @@ export const keel = <T extends new (...args: any[]) => any>(Client: T) => {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
const clientConstructor = Client as new (args: any) => any;
|
|
37
|
-
const clientArgs = {
|
|
37
|
+
const clientArgs = { baseUrl, ...config };
|
|
38
38
|
const clientRef = useRef(new clientConstructor(clientArgs));
|
|
39
39
|
|
|
40
40
|
const client = clientRef.current;
|
|
41
41
|
|
|
42
42
|
useEffect(() => {
|
|
43
|
-
client.
|
|
44
|
-
}, [
|
|
43
|
+
client.client.setBaseUrl(baseUrl);
|
|
44
|
+
}, [baseUrl, client]);
|
|
45
45
|
|
|
46
46
|
return (
|
|
47
47
|
<KeelContext.Provider value={{ client }}>{children}</KeelContext.Provider>
|