File tree Expand file tree Collapse file tree 2 files changed +23
-17
lines changed
apps/dashboard/src/app/pay Expand file tree Collapse file tree 2 files changed +23
-17
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,12 @@ import { payLandingWallets } from "./wallets";
99const client = getClientThirdwebClient ( ) ;
1010
1111export function StyledBuyWidget (
12- props : Omit < BuyWidgetProps , "client" | "theme" > ,
12+ props : Omit <
13+ BuyWidgetProps ,
14+ "client" | "theme" | "onSuccess" | "onError" | "onCancel"
15+ > & {
16+ successUrl ?: string ;
17+ } ,
1318) {
1419 const { theme } = useTheme ( ) ;
1520
@@ -22,6 +27,22 @@ export function StyledBuyWidget(
2227 connectOptions = { {
2328 wallets : payLandingWallets ,
2429 } }
30+ onSuccess = { ( ) => {
31+ if ( props . successUrl ) {
32+ try {
33+ const url = new URL ( props . successUrl ) ;
34+ url . searchParams . set ( "success" , "true" ) ;
35+ window . location . href = url . toString ( ) ;
36+ } catch ( error ) {
37+ // Log URL construction error for debugging
38+ console . error (
39+ "Failed to construct redirect URL:" ,
40+ props . successUrl ,
41+ error ,
42+ ) ;
43+ }
44+ }
45+ } }
2546 />
2647 ) ;
2748}
Original file line number Diff line number Diff line change @@ -76,22 +76,7 @@ export default async function PayPage(props: {
7676 tokenAddress = { token }
7777 receiverAddress = { receiver }
7878 amount = { amount ? amount . toString ( ) : undefined }
79- onSuccess = { ( ) => {
80- if ( successUrl ) {
81- try {
82- const url = new URL ( successUrl ) ;
83- url . searchParams . set ( "success" , "true" ) ;
84- window . location . href = url . toString ( ) ;
85- } catch ( error ) {
86- // Log URL construction error for debugging
87- console . error (
88- "Failed to construct redirect URL:" ,
89- successUrl ,
90- error ,
91- ) ;
92- }
93- }
94- } }
79+ successUrl = { successUrl }
9580 />
9681 </ div >
9782 </ div >
You can’t perform that action at this time.
0 commit comments