fix redirect url for customer portal sent for electron app
This commit is contained in:
parent
fbd31b0ec2
commit
0bece9d273
|
@ -170,12 +170,7 @@ class billingService {
|
||||||
action: string
|
action: string
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
let redirectURL;
|
const redirectURL = this.getRedirectURL();
|
||||||
if (isElectron()) {
|
|
||||||
redirectURL = DESKTOP_REDIRECT_URL;
|
|
||||||
} else {
|
|
||||||
redirectURL = `${window.location.origin}/gallery`;
|
|
||||||
}
|
|
||||||
window.location.href = `${getPaymentsURL()}?productID=${productID}&paymentToken=${paymentToken}&action=${action}&redirectURL=${redirectURL}`;
|
window.location.href = `${getPaymentsURL()}?productID=${productID}&paymentToken=${paymentToken}&action=${action}&redirectURL=${redirectURL}`;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logError(e, 'unable to get payments url');
|
logError(e, 'unable to get payments url');
|
||||||
|
@ -185,9 +180,10 @@ class billingService {
|
||||||
|
|
||||||
public async redirectToCustomerPortal() {
|
public async redirectToCustomerPortal() {
|
||||||
try {
|
try {
|
||||||
|
const redirectURL = this.getRedirectURL();
|
||||||
const response = await HTTPService.get(
|
const response = await HTTPService.get(
|
||||||
`${ENDPOINT}/billing/stripe/customer-portal`,
|
`${ENDPOINT}/billing/stripe/customer-portal`,
|
||||||
{ redirectURL: `${window.location.origin}/gallery` },
|
{ redirectURL },
|
||||||
{
|
{
|
||||||
'X-Auth-Token': getToken(),
|
'X-Auth-Token': getToken(),
|
||||||
}
|
}
|
||||||
|
@ -198,6 +194,14 @@ class billingService {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public getRedirectURL() {
|
||||||
|
if (isElectron()) {
|
||||||
|
return DESKTOP_REDIRECT_URL;
|
||||||
|
} else {
|
||||||
|
return `${window.location.origin}/gallery`;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default new billingService();
|
export default new billingService();
|
||||||
|
|
Loading…
Reference in a new issue