-
Notifications
You must be signed in to change notification settings - Fork 452
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Query issue: Amount does not show on pending page #202
Comments
This is a little bit fiddly with the architecture of the app, but you can do it with relatively little change by updating Taking a step back, the reason this doesn't work currently is because recipient, label and message all come from So if we want to make this work we need to read the In With this: const router = useRouter(); // import { useRouter } from 'next/router';
const { amount: queryAmount } = router.query;
const initialAmount = useMemo(() => {
if (!queryAmount) return undefined;
if (Array.isArray(queryAmount)) return new BigNumber(queryAmount[0]);
return new BigNumber(queryAmount)
}, [queryAmount])
const [amount, setAmount] = useState<BigNumber | undefined>(initialAmount); Now the Example commit making this change: master...mcintyre94:solana-pay:cm-url-amount |
Thank you very much. Did you commited this line to the main brunch? Cool. I am looking forward to use this tool. Perfect for so many use cases. |
http://localhost:3000/pending?recipient=54LnyoDbFvSXG4doBpfrZUoytQcJECWqkvDAjjh7sny7&amount=1&label=stark&message=great
The amount is set to 1 but, on the pending page it shows me 0. I have not used the new page to create an QR Code directly, I wanted to use it similar to other pay systems like paypal.
Any idea, what to change? I also saw the getServerSideProps, does this have to do anything with my issue?
export function getServerSideProps() { // Required so getInitialProps re-runs on the server-side // If it runs on client-side then there's no req and the URL reading doesn't work // See https://nextjs.org/docs/api-reference/data-fetching/get-initial-props return { props: {}, }; }
Any help strongly appreciated. 🙌😎😎😎
The text was updated successfully, but these errors were encountered: