Skip to content

Commit

Permalink
fix: Fetch timeout (#523)
Browse files Browse the repository at this point in the history
  • Loading branch information
rrr523 authored Apr 21, 2024
1 parent 504b926 commit e746b6c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/four-baboons-itch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@bnb-chain/greenfield-js-sdk': patch
---

fix: Fetch timeout
1 change: 1 addition & 0 deletions examples/nextjs/src/components/object/create/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ export const CreateObject = () => {
objectName: createObjectInfo.objectName,
body: file,
txnHash: txHash,
duration: 20000,
},
{
type: 'EDDSA',
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"name": "@bnb-chain/greenfield-js-sdk",
"packageManager": "[email protected]",
"version": "0.0.1",
"private": true,
"description": "Green Field JS SDK",
Expand Down
12 changes: 8 additions & 4 deletions packages/js-sdk/src/clients/spclient/spClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,14 @@ export class SpClient implements ISpClient {
try {
const controller = new AbortController();
const _id = setTimeout(() => controller.abort(), timeout);
const response = await fetchWithTimeout(url, {
...options,
signal: controller.signal,
});
const response = await fetchWithTimeout(
url,
{
...options,
signal: controller.signal,
},
timeout,
);
clearTimeout(_id);

const { status } = response;
Expand Down

0 comments on commit e746b6c

Please sign in to comment.