@36node/auth-sdk 1.5.1 → 1.6.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/README.md CHANGED
@@ -1,3 +1,28 @@
1
1
  # auth-sdk-ts
2
2
 
3
3
  Typescript auth sdk for 36node/auth service.
4
+
5
+ 本工程是通过 `@hey-api/openapi-ts` 生成
6
+
7
+ ## 配置 baseUrl 和 拦截器
8
+
9
+ ```ts
10
+ import { client } from '@36node/auth-sdk';
11
+
12
+ // configure internal service client
13
+ client.setConfig({
14
+ // set default base url for requests
15
+ baseUrl: 'https://petstore3.swagger.io/api/v3',
16
+ // set default headers for requests
17
+ headers: {
18
+ Authorization: 'Bearer <token_from_service_client>',
19
+ },
20
+ });
21
+
22
+ client.interceptors.response.use((response) => {
23
+ if (response.status === 200) {
24
+ console.log(`request to ${response.url} was successful`);
25
+ }
26
+ return response;
27
+ });
28
+ ```