Skip to content

Commit

Permalink
Use current url origin so full url works in every staging
Browse files Browse the repository at this point in the history
  • Loading branch information
teodorus-nathaniel committed Mar 6, 2024
1 parent 519ebb1 commit 4c8748e
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/components/urls/helpers.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { nonEmptyArr, nonEmptyStr } from '@subsocial/utils'
import copy from 'copy-to-clipboard'
import { CSSProperties } from 'react'
import config from 'src/config'
import { getCurrentUrlOrigin } from 'src/utils/url'
import { showInfoMessage } from '../utils/Message'
import { BareProps } from '../utils/types'

const { appBaseUrl } = config

export const openNewWindow = (url: string) => {
const biggerWindow = window.innerWidth > 650
window.open(
Expand Down Expand Up @@ -98,5 +96,6 @@ export const innerFullUrl = (appBaseUrl: string, relative: string) => {
return base + pathname
}

export const fullUrl = (relative: string, externalBaseUrl?: string) =>
innerFullUrl(externalBaseUrl || appBaseUrl, relative)
export const fullUrl = (relative: string, externalBaseUrl?: string) => {
return innerFullUrl(externalBaseUrl || getCurrentUrlOrigin(), relative)
}

0 comments on commit 4c8748e

Please sign in to comment.