@ossy/sdk-react 0.8.2 → 0.8.3

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/README.md +15 -14
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -5,32 +5,32 @@ with react hooks you can use to fetch data.
5
5
 
6
6
  ## Getting started
7
7
 
8
- To use these hooks install the package **@ossy/cms-client-react**
8
+ To use these hooks install the package **@ossy/sdk-react** along with **@ossy/sdk**:
9
9
 
10
10
  ```
11
- npm install @ossy/cms-client-react
11
+ npm install @ossy/sdk-react @ossy/sdk
12
12
  ```
13
13
 
14
- Then we simply need to wrap our app in a <WorkspaceProvider /> that will
15
- handle data storage and configuration for us.
16
- You will need the workspaceId for the workspace you want to fetch data from.
17
- The workspaceId can be found in the list of workspaces you have access to or
18
- in the url when you view the resources in the UI.
14
+ Create an SDK instance and wrap your app in `<WorkspaceProvider />` to handle
15
+ data storage and configuration:
19
16
 
20
- ```
17
+ ```jsx
21
18
  // App.jsx
22
- import { WorkspaceProvider } from '@ossy/cms-client-react'
19
+ import { WorkspaceProvider } from '@ossy/sdk-react'
20
+ import { SDK } from '@ossy/sdk'
23
21
  import { MyComponent } from './MyComponent.jsx'
24
22
 
23
+ const sdk = new SDK({ baseUrl: 'https://your-api.example.com' })
24
+
25
25
  export const App = () => (
26
- <WorkspaceProvider workspaceId="your-workspace-id">
26
+ <WorkspaceProvider sdk={sdk}>
27
27
  <MyComponent />
28
28
  </WorkspaceProvider>
29
29
  )
30
30
  ```
31
- ```
31
+ ```jsx
32
32
  // MyComponent.jsx
33
- import { useResources } from '@ossy/cms-client-react'
33
+ import { useResources } from '@ossy/sdk-react'
34
34
 
35
35
  export const MyComponent = () => {
36
36
  const { status, resources } = useResources('/folder/path/in/cms')
@@ -62,12 +62,12 @@ export const MyComponent = () => {
62
62
  ### useResources
63
63
 
64
64
  ```
65
- const { status, resources } = useResources('/')
65
+ const { status, resources, loadResources } = useResources('/')
66
66
  ```
67
67
 
68
68
  **Parameters**
69
69
 
70
- - **path** - Folder path in the cms UI
70
+ - **path** - (optional) Folder path in the cms UI. Defaults to `/` when omitted.
71
71
 
72
72
  **Returns**
73
73
 
@@ -78,6 +78,7 @@ Returns an object containing
78
78
  Possible values are: NotInitialized, Loading, Success, Error
79
79
  - **resources** - Array of resources, defaults to an empty array when
80
80
  loading is not Success
81
+ - **loadResources** - Function to manually refetch the resource list
81
82
 
82
83
  ### useResource
83
84
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ossy/sdk-react",
3
- "description": "Sofware Development Kit React",
4
- "version": "0.8.2",
3
+ "description": "Software Development Kit React",
4
+ "version": "0.8.3",
5
5
  "url": "git://github.com/ossy-se/packages/sdk-react",
6
6
  "source": "src/public.index.ts",
7
7
  "module": "build/sdk-react/src/public.index.js",
@@ -56,5 +56,5 @@
56
56
  "/build",
57
57
  "README.md"
58
58
  ],
59
- "gitHead": "f52cd0ffa2b4d7590570e384da55688c873871b3"
59
+ "gitHead": "4116cb86c14d3d9b01d3a2e37a9ce0835bbe7e41"
60
60
  }