Skip to content

Commit

Permalink
fit(frontend): fix getOpenPaymentsUrl function (#3162)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkurapov authored Dec 9, 2024
1 parent 61a4028 commit b83ac58
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/frontend/app/shared/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,18 @@ export function capitalize(str: string) {
}

export function getOpenPaymentsUrl() {
if (!process.env.OPEN_PAYMENTS_URL) {
throw new Error('Environment variable OPEN_PAYMENTS_URL is missing')
}

if (typeof window === 'undefined') {
if (!process.env.OPEN_PAYMENTS_URL) {
throw new Error('Environment variable OPEN_PAYMENTS_URL is missing')
}

return process.env.OPEN_PAYMENTS_URL
}

if (!window.ENV.OPEN_PAYMENTS_URL) {
throw new Error('Environment variable OPEN_PAYMENTS_URL is missing')
}

return window.ENV.OPEN_PAYMENTS_URL
}

Expand Down

0 comments on commit b83ac58

Please sign in to comment.