From 4c8748eaf296d9c7b66d616b7aa775b5795b4a62 Mon Sep 17 00:00:00 2001 From: teodorus-nathaniel Date: Wed, 6 Mar 2024 13:44:42 +0700 Subject: [PATCH] Use current url origin so full url works in every staging --- src/components/urls/helpers.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/components/urls/helpers.tsx b/src/components/urls/helpers.tsx index 968a4e583..6647a9a43 100644 --- a/src/components/urls/helpers.tsx +++ b/src/components/urls/helpers.tsx @@ -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( @@ -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) +}