Merge pull request #695 from ente-io/fix-buy-subscription-on-desktop
fix buy subscription on desktop
This commit is contained in:
commit
d2d40e747f
1
src/constants/billing/index.ts
Normal file
1
src/constants/billing/index.ts
Normal file
|
@ -0,0 +1 @@
|
|||
export const DESKTOP_REDIRECT_URL = 'https://payments.ente.io/desktop-redirect';
|
|
@ -5,6 +5,8 @@ import HTTPService from './HTTPService';
|
|||
import { logError } from 'utils/sentry';
|
||||
import { getPaymentToken } from './userService';
|
||||
import { Plan, Subscription } from 'types/billing';
|
||||
import isElectron from 'is-electron';
|
||||
import { DESKTOP_REDIRECT_URL } from 'constants/billing';
|
||||
|
||||
const ENDPOINT = getEndpoint();
|
||||
|
||||
|
@ -168,9 +170,13 @@ class billingService {
|
|||
action: string
|
||||
) {
|
||||
try {
|
||||
window.location.href = `${getPaymentsURL()}?productID=${productID}&paymentToken=${paymentToken}&action=${action}&redirectURL=${
|
||||
window.location.origin
|
||||
}/gallery`;
|
||||
let redirectURL;
|
||||
if (isElectron()) {
|
||||
redirectURL = DESKTOP_REDIRECT_URL;
|
||||
} else {
|
||||
redirectURL = `${window.location.origin}/gallery`;
|
||||
}
|
||||
window.location.href = `${getPaymentsURL()}?productID=${productID}&paymentToken=${paymentToken}&action=${action}&redirectURL=${redirectURL}`;
|
||||
} catch (e) {
|
||||
logError(e, 'unable to get payments url');
|
||||
throw e;
|
||||
|
|
Loading…
Reference in a new issue