Skip to content
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

onRedirect called twice #39

Closed
georgeben opened this issue Dec 13, 2021 · 1 comment
Closed

onRedirect called twice #39

georgeben opened this issue Dec 13, 2021 · 1 comment

Comments

@georgeben
Copy link

I don't understand why on onRedirect is being called twice. Here's a snippet of my code.

async function handleRedirect(params) {
    console.log("Params!", params);
    if (loading) return
    setLoading(true);
    setShowPaymentDialog(false);
    if (params.status == "cancelled") {
      return;
    }
    try {
      console.log("Verifying transaction", params.tx_ref);
      const transactionResponse = await verifyTransaction(params.tx_ref);
      const transaction = transactionResponse.data.transaction;

      setTransaction(transaction);
    } catch (error) {
      console.log("Error", error);
    } finally {
      setLoading(false);
    }
  }
<FlutterwaveCheckout
          onAbort={handleAbort}
          onRedirect={handleRedirect}
          link={paymentLink || undefined}
          visible={showPaymentDialog}
        />

Please what am I doing wrong?

@thecodecafe
Copy link
Collaborator

Duplicate of #40

@thecodecafe thecodecafe marked this as a duplicate of #40 Dec 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants