@teamkeel/client-react 0.364.2 → 0.365.0

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.tsx +6 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamkeel/client-react",
3
- "version": "0.364.2",
3
+ "version": "0.365.0",
4
4
  "description": "React helpers for Keel clients",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
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 endpoint URL for the client.
16
+ * The base URL for the client.
17
17
  */
18
- endpoint: string;
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
- endpoint,
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 = { endpoint, ...config };
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._setEndpoint(endpoint);
44
- }, [endpoint, client]);
43
+ client.client.setBaseUrl(baseUrl);
44
+ }, [baseUrl, client]);
45
45
 
46
46
  return (
47
47
  <KeelContext.Provider value={{ client }}>{children}</KeelContext.Provider>