Next.js Discord

Discord Forum

server action call in useEffect not displaying result

Unanswered
Bristle-thighed Curlew posted this in #help-forum
Open in Discord
Avatar
Bristle-thighed CurlewOP
I have a server action that calls Stripe to fetch the client_secret. The call is made in a useEffect in a client page component (see below). While I see the call and results on Stripe and in the payload displayed on the network tab of the browser, the response is not available in the application. Note the application is Typescript/NextJS using convex for DB and convex-auth for auth. Can you help me understand what I'm doing wrong? Or, what I can change to make the value returned visible/available in the application?
<code>
React.useEffect(() => {
if(stripeContainerPromise) {
setStripePromise(stripeContainerPromise)
}

if(stripePromise
&& verificationSessionParams?.provided_details?.email) {
createVerificationSession(verificationSessionParams)
.then((res: any) => {
if(res && res.clientSecret) {
setClientSecret(res.clientSecret);
}
});
}

}, [stripePromise, verificationSessionParams, setClientSecret]);
</code>

0 Replies