fix redirect url for customer portal sent for electron app

This commit is contained in:
Abhinav 2022-09-23 18:37:46 +05:30
parent fbd31b0ec2
commit 0bece9d273

View file

@ -170,12 +170,7 @@ class billingService {
action: string
) {
try {
let redirectURL;
if (isElectron()) {
redirectURL = DESKTOP_REDIRECT_URL;
} else {
redirectURL = `${window.location.origin}/gallery`;
}
const redirectURL = this.getRedirectURL();
window.location.href = `${getPaymentsURL()}?productID=${productID}&paymentToken=${paymentToken}&action=${action}&redirectURL=${redirectURL}`;
} catch (e) {
logError(e, 'unable to get payments url');
@ -185,9 +180,10 @@ class billingService {
public async redirectToCustomerPortal() {
try {
const redirectURL = this.getRedirectURL();
const response = await HTTPService.get(
`${ENDPOINT}/billing/stripe/customer-portal`,
{ redirectURL: `${window.location.origin}/gallery` },
{ redirectURL },
{
'X-Auth-Token': getToken(),
}
@ -198,6 +194,14 @@ class billingService {
throw e;
}
}
public getRedirectURL() {
if (isElectron()) {
return DESKTOP_REDIRECT_URL;
} else {
return `${window.location.origin}/gallery`;
}
}
}
export default new billingService();