@longvansoftware/storefront-js-client 1.8.3 → 1.8.4
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/dist/src/lib/SDK.js
CHANGED
|
@@ -59,7 +59,7 @@ class SDK {
|
|
|
59
59
|
this.warehouseV2.setToken(token);
|
|
60
60
|
this.deepLinkVietQr.setToken(token);
|
|
61
61
|
this.campaign.setToken(token);
|
|
62
|
-
this.shareZalo.setToken(token)
|
|
62
|
+
// this.shareZalo.setToken(token)
|
|
63
63
|
// Set token for other services here
|
|
64
64
|
}
|
|
65
65
|
// các module export từ serviceSDK.ts set storeId vào serviceSDK.ts
|
|
@@ -15,6 +15,7 @@ export declare class Service {
|
|
|
15
15
|
protected graphqlMutation(mutation: DocumentNode, variables: any): Promise<any>;
|
|
16
16
|
protected restApiCallWithToken(path: string, method: "GET" | "POST" | "PUT" | "DELETE", data?: any, headers?: any): Promise<any>;
|
|
17
17
|
protected restApiCallWithNoToken(path: string, method: "GET" | "POST" | "PUT" | "DELETE", data?: any, headers?: any): Promise<any>;
|
|
18
|
+
protected restApiCallWithNoHeader(path: string, method: "GET" | "POST" | "PUT" | "DELETE", data?: any, headers?: any): Promise<any>;
|
|
18
19
|
protected graphqlQueryV2(query: DocumentNode, variables: any): Promise<any>;
|
|
19
20
|
protected graphqlMutationV2(mutation: DocumentNode, variables: any): Promise<any>;
|
|
20
21
|
protected graphqlQueryV3(query: DocumentNode, variables: any): Promise<any>;
|
|
@@ -142,6 +142,29 @@ class Service {
|
|
|
142
142
|
}
|
|
143
143
|
});
|
|
144
144
|
}
|
|
145
|
+
// call api no header
|
|
146
|
+
restApiCallWithNoHeader(path, method, data, headers) {
|
|
147
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
148
|
+
try {
|
|
149
|
+
// const modifiedHeaders = {
|
|
150
|
+
// ...headers,
|
|
151
|
+
// Partnerid: this.orgId,
|
|
152
|
+
// };
|
|
153
|
+
const response = yield (0, axios_1.default)({
|
|
154
|
+
url: this.endpoint + path,
|
|
155
|
+
method,
|
|
156
|
+
data,
|
|
157
|
+
// headers: modifiedHeaders,
|
|
158
|
+
});
|
|
159
|
+
return response.data;
|
|
160
|
+
}
|
|
161
|
+
catch (error) {
|
|
162
|
+
console.log(`Error in restApiCallWithNoToken: ${error}`);
|
|
163
|
+
throw error;
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
//
|
|
145
168
|
graphqlQueryV2(query, variables) {
|
|
146
169
|
return __awaiter(this, void 0, void 0, function* () {
|
|
147
170
|
try {
|
|
@@ -20,7 +20,7 @@ class ShareZaloService extends serviceSDK_1.Service {
|
|
|
20
20
|
const endpoint = ``;
|
|
21
21
|
const method = "POST";
|
|
22
22
|
try {
|
|
23
|
-
const response = yield this.
|
|
23
|
+
const response = yield this.restApiCallWithNoHeader(endpoint, method, dataRequet);
|
|
24
24
|
return response;
|
|
25
25
|
}
|
|
26
26
|
catch (error) {
|