I'm posting data to an internal API which queries a DB to find a match and retrieves the rest of the data in the columns.I want the result of the query to be redirected to another page for display.
async function handleSubmit(e){
e.preventDefault()
const info = {referall,vclass,cover,coverPeriod}
const res = await axios.post("/api/setquote", info);
if (res.status === 200){
router.push('/pick-product')
}else{
alert('product does not exist')
}
Its quite easy I just needed to use the useRouter hook and pass in the result as a query parameter then call in the getintialprops of the page I'm redirecting to.