My project is with next.js
/auth/register
My Registration page is with a mobile number, when user enters his mobile number, the number is send to the API.
/api/v1/auth/register
At the API point, the mobile number is checked to see if it already exist or not. if not, the mobile number is stored in the MongoDB with OTP and Expiration time (2 minute).and then API send successful response as JSON to the registration page.
/auth/register/code
The second page is the OTP code verification. User must enter the received 6 digit OTP code from the SMS here.
if the code is correct, the registration process will be completed successfully.
What is my problem?
So, I want entered mobile number to be send to the OTP page exactly after the API response. I do not want to use
router.push('/auth/register/code', { mobile: 1234567890 });
because I do not want to have a query in the URL. Can I send JSON to another page? Or can I use the API to send the result to the second page instead of going back to the first page?
Or what is the better way to solve my problem?