twindex-openclaw-plugin 0.7.3 → 0.7.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/package.json +1 -1
- package/src/client.ts +12 -2
package/package.json
CHANGED
package/src/client.ts
CHANGED
|
@@ -219,9 +219,19 @@ export async function tryOn(
|
|
|
219
219
|
if (productName) {
|
|
220
220
|
payload.product_name = productName;
|
|
221
221
|
}
|
|
222
|
-
|
|
222
|
+
const url = `${BASE_URL}/api/v1/try-on`;
|
|
223
|
+
const res = await fetch(url, {
|
|
223
224
|
method: "POST",
|
|
224
|
-
headers:
|
|
225
|
+
headers: {
|
|
226
|
+
"Content-Type": "application/json",
|
|
227
|
+
...authHeader(apiKey),
|
|
228
|
+
},
|
|
225
229
|
body: JSON.stringify(payload),
|
|
230
|
+
signal: AbortSignal.timeout(60_000),
|
|
226
231
|
});
|
|
232
|
+
if (!res.ok) {
|
|
233
|
+
const body = await res.text().catch(() => "");
|
|
234
|
+
throw new Error(`Twindex API ${res.status}: ${body}`);
|
|
235
|
+
}
|
|
236
|
+
return res.json() as Promise<TryOnResult>;
|
|
227
237
|
}
|