@qelos/web-sdk 3.1.28 → 3.1.30
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/README.md +14 -34
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,47 +1,27 @@
|
|
|
1
|
-
# @qelos/sdk
|
|
2
|
-
|
|
3
|
-
SDK to use Qelos common API endpoints.
|
|
4
|
-
|
|
5
|
-
Can be used for both backend and frontend applications.
|
|
1
|
+
# @qelos/web-sdk
|
|
6
2
|
|
|
3
|
+
A package to manage communication between a Plugin MFE to a QELOS application host.
|
|
7
4
|
## Installation
|
|
8
5
|
|
|
9
6
|
```shell
|
|
10
|
-
npm install @qelos/sdk
|
|
7
|
+
npm install @qelos/web-sdk
|
|
11
8
|
```
|
|
12
9
|
|
|
13
10
|
## Usage
|
|
14
11
|
|
|
15
12
|
```typescript
|
|
16
|
-
|
|
17
|
-
import QelosSDK from '@qelos/sdk';
|
|
13
|
+
import { authorize, code } from "@qelos/web-sdk";
|
|
18
14
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
function MyPostsList() {
|
|
30
|
-
const [posts, setPosts] = useState([]);
|
|
31
|
-
const [querySearch, setQuery] = useState([]);
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
sdk.posts.getList({q: querySearch, limit: 50});
|
|
34
|
-
}, [querySearch]);
|
|
35
|
-
|
|
36
|
-
return (
|
|
37
|
-
<div>
|
|
38
|
-
<input type="text" placeholder="Search posts" onChange={e => setQuery(e.target.value)}/>
|
|
39
|
-
{
|
|
40
|
-
posts.map(post => <PostItem post={post} key={post._id}/>)
|
|
41
|
-
}
|
|
42
|
-
</div>
|
|
43
|
-
)
|
|
44
|
-
}
|
|
15
|
+
// authorize your micro-frontend application
|
|
16
|
+
// to recognize the user and tenant of host application:
|
|
17
|
+
const { user, tenant } = authorize();
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
// add the "code" parameter given from this web-sdk
|
|
21
|
+
// it's a code created for this specific intercation with the user:
|
|
22
|
+
fetch('/api/you-own-api', {
|
|
23
|
+
headers: { code }
|
|
24
|
+
})
|
|
45
25
|
```
|
|
46
26
|
|
|
47
27
|
Enjoy!
|