Skip to content

Commit

Permalink
fix: DASH-410 (#5328)
Browse files Browse the repository at this point in the history
FIXES: DASH-410

<!-- start pr-codex -->

---

## PR-Codex overview
This PR primarily focuses on improving error handling and code clarity in the `apps/dashboard` project. It modifies the `package.json` script for development, enhances JWT response validation, and adjusts value handling in a hook for better consistency.

### Detailed summary
- Updated the `dev` script in `apps/dashboard/package.json` to remove `--turbopack`.
- Added error handling for missing JWT in `apps/dashboard/src/@/constants/thirdweb.client.ts`.
- Changed return value handling to ensure it returns a `BigInt` in `apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/_components/claim-conditions/claim-conditions-form/hooks.ts`.

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`

<!-- end pr-codex -->
  • Loading branch information
jnsdls committed Nov 6, 2024
1 parent 562978f commit 11d287b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion apps/dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"scripts": {
"preinstall": "npx only-allow pnpm",
"dev": "next dev --turbopack",
"dev": "next dev",
"build": "next build",
"start": "next start",
"format": "biome format ./src --write",
Expand Down
5 changes: 4 additions & 1 deletion apps/dashboard/src/@/constants/thirdweb.client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ export function useThirdwebClient(jwt?: string) {
throw new Error("Failed to get auth token");
}
const json = (await res.json()) as GetAuthTokenResponse;
return json.jwt || undefined;
if (!json.jwt) {
throw new Error("No JWT in response");
}
return json.jwt;
},
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ function toBigInt(value: string | number | undefined): bigint | undefined {
if (value === "unlimited") {
return maxUint256;
}
return BigInt(value);
}

// The input from client-side is non-wei, but the extension is expecting value in wei
Expand Down

0 comments on commit 11d287b

Please sign in to comment.