1

I use NavigationMixin.Navigate for redirection to external sites. It does work in Lightning App (internal SF) but does not work in Community. Here is the code:

class definition:

export default class SubscriptionRenewal extends NavigationMixin(LightningElement) {

function that uses redirect:

proceedToPayment({ paymentData: JSON.stringify(this.pricingOption) })
        .then(result => {               
            this.isLoading = false;
            const computopUrl = result;
            this[NavigationMixin.Navigate]({
                type: "standard__webPage",
                attributes: {
                    url: computopUrl,
                    replace: false
                }
            });
        })
        .catch(error => {
            console.error('error>>>' + error.body.message);
            this.isError = true;
            this.errors = error.body.message;
        }
    );

I cannot understand why it does not work in the Community, there are no errors. By the way, in another Full Copy Sandbox I created an LWC component and use NavigationMixin in the Community as well, and it works fine there.

code in another Community:

backToLogin(event) {
    this[NavigationMixin.Navigate]({
        type: "standard__webPage",
        attributes: {
            url: this.loginUrl,
            replace: true
        }
    });
}

this.loginUrl is a string returned by Apex in connectedCallback().

And it works just fine there.

Did anyone face this issue or can explain to me what is wrong?

1
  • @PranayJaiswal, hmm. But it does work in another Sandbox, but I do not use it on the result from Apex, just pass the URL.
    – m_konyk
    Commented Mar 21, 2019 at 10:18

0

Browse other questions tagged .