@reevit/react 0.2.3 → 0.2.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/index.js +10 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -109,15 +109,19 @@ var ReevitAPIClient = class {
|
|
|
109
109
|
async request(method, path, body) {
|
|
110
110
|
const controller = new AbortController();
|
|
111
111
|
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
112
|
+
const headers = {
|
|
113
|
+
"Content-Type": "application/json",
|
|
114
|
+
"X-Reevit-Key": this.publicKey,
|
|
115
|
+
"X-Reevit-Client": "@reevit/react",
|
|
116
|
+
"X-Reevit-Client-Version": "0.2.3"
|
|
117
|
+
};
|
|
118
|
+
if (method === "POST" || method === "PATCH" || method === "PUT") {
|
|
119
|
+
headers["Idempotency-Key"] = `${Date.now()}-${Math.random().toString(36).substring(2, 15)}`;
|
|
120
|
+
}
|
|
112
121
|
try {
|
|
113
122
|
const response = await fetch(`${this.baseUrl}${path}`, {
|
|
114
123
|
method,
|
|
115
|
-
headers
|
|
116
|
-
"Content-Type": "application/json",
|
|
117
|
-
"Authorization": `Bearer ${this.publicKey}`,
|
|
118
|
-
"X-Reevit-Client": "@reevit/react",
|
|
119
|
-
"X-Reevit-Client-Version": "1.0.0"
|
|
120
|
-
},
|
|
124
|
+
headers,
|
|
121
125
|
body: body ? JSON.stringify(body) : void 0,
|
|
122
126
|
signal: controller.signal
|
|
123
127
|
});
|