@bzbs/react-api-client 0.0.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 ADDED
@@ -0,0 +1,54 @@
1
+ ###### Example initail Lib ####
2
+
3
+ // "use client";
4
+ import axios, { AxiosError } from "axios";
5
+ import { bzbsService } from "module-demo-bzbs";
6
+ import { EnvConfig } from "./utils/env-config";
7
+ import curlirize from 'axios-curlirize';
8
+
9
+ var client = axios.create({});
10
+
11
+
12
+ client.interceptors.request.use(
13
+ async (config) => {
14
+ config.headers["Content-Type"] = "application/json, multipart/form-data";
15
+ config.headers["App-Id"] = 2952697274802274;
16
+ config.headers["Ocp-Apim-Subscription-Key"] =
17
+ "89c1d9bafb65486aa02606f63cb86b5c";
18
+
19
+ // if (accessToken) {
20
+ // config.headers["Authorization"] = `token ${accessToken.value}`;
21
+ // }
22
+ return config;
23
+ },
24
+ (error) => {
25
+ return Promise.reject(error);
26
+ }
27
+ );
28
+
29
+ // Response interceptor
30
+ client.interceptors.response.use(
31
+ (response) => {
32
+ console.log("response : %O", response.data);
33
+
34
+ return response;
35
+ },
36
+ (error) => {
37
+ // Handle response errors here
38
+
39
+ if (error instanceof AxiosError) {
40
+ console.log("error AxiosError: %O", error.message);
41
+ } else {
42
+ console.log("object: %O", error);
43
+ }
44
+ return Promise.reject(error);
45
+ }
46
+ );
47
+ curlirize(client);
48
+ export const serviceBzbs = new bzbsService(
49
+ client,
50
+ "https://apigateway.buzzebees-uat.com/api/",
51
+ "aaa"
52
+ );
53
+
54
+ ######