Skip to content

Commit

Permalink
fix(bildungsraum-share): remove unnecessary domain getter
Browse files Browse the repository at this point in the history
  • Loading branch information
hejtful committed Dec 19, 2024
1 parent 7426156 commit 62b8920
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions apps/web/src/components/user-tools/share/share-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ interface EntryData {
onClick?: (event: MouseEvent) => void
}

const base = getBase(window.location.host)

export function ShareModal({
isOpen,
setIsOpen,
Expand Down Expand Up @@ -78,7 +76,7 @@ export function ShareModal({
async function copyContentToClipboard() {
if (!pathOrId) return
try {
const url = `${base}/api/frontend/bildungsraum-share?href=${encodeURIComponent(pathOrId)}`
const url = `/api/frontend/bildungsraum-share?href=${encodeURIComponent(pathOrId)}`
const res = await fetch(url)
const data = (await res.json()) as string
if (!res.ok) {
Expand Down Expand Up @@ -264,13 +262,3 @@ const shareButton = cn(`
mx-side mt-1.5 block py-0.5 text-base
sm:ml-3 sm:mr-0 sm:mt-0 sm:inline
`)

function getBase(currentHost: string) {
if (currentHost.endsWith('serlo-staging.dev'))
return 'https://de.serlo-staging.dev'
if (currentHost.endsWith('serlo.org')) return 'https://' + currentHost

return process.env.NODE_ENV === 'development'
? 'http://localhost:3000'
: 'https://de.serlo.org'
}

0 comments on commit 62b8920

Please sign in to comment.