Compare commits

...

1 Commits

Author SHA1 Message Date
James Murdza
e58d088b5f Replace references to the app base URL with a dynamically generated URL. 2024-06-07 17:03:56 -04:00
3 changed files with 4 additions and 4 deletions

View File

@ -42,7 +42,7 @@ export default function CodeEditor({
reactDefinitionFile: string
}) {
const socket = io(
`http://localhost:${process.env.NEXT_PUBLIC_SERVER_PORT}?userId=${userData.id}&sandboxId=${sandboxData.id}`,
`${window.location.protocol}//${window.location.hostname}:${process.env.NEXT_PUBLIC_SERVER_PORT}?userId=${userData.id}&sandboxId=${sandboxData.id}`,
{
timeout: 2000,
}

View File

@ -120,7 +120,7 @@ export default function ShareSandboxModal({
<Button
onClick={() => {
navigator.clipboard.writeText(
`${process.env.NEXT_PUBLIC_APP_URL}/code/${data.id}`
`${window.location.protocol}//${window.location.hostname}/code/${data.id}`
)
toast.success("Link copied to clipboard.")
}}

View File

@ -45,7 +45,7 @@ export default function PreviewWindow({
<PreviewButton
onClick={() => {
navigator.clipboard.writeText(`http://localhost:5173`)
navigator.clipboard.writeText(`${window.location.protocol}//${window.location.hostname}:5173`)
toast.info("Copied preview link to clipboard")
}}
>
@ -73,7 +73,7 @@ export default function PreviewWindow({
ref={ref}
width={"100%"}
height={"100%"}
src={`http://localhost:5173`}
src={`${window.location.protocol}//${window.location.hostname}:5173`}
/>
</div>
)}