Replace references to the app base URL with a dynamically generated URL.
This commit is contained in:
parent
e5a36a4626
commit
e58d088b5f
@ -42,7 +42,7 @@ export default function CodeEditor({
|
|||||||
reactDefinitionFile: string
|
reactDefinitionFile: string
|
||||||
}) {
|
}) {
|
||||||
const socket = io(
|
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,
|
timeout: 2000,
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,7 @@ export default function ShareSandboxModal({
|
|||||||
<Button
|
<Button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
navigator.clipboard.writeText(
|
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.")
|
toast.success("Link copied to clipboard.")
|
||||||
}}
|
}}
|
||||||
|
@ -45,7 +45,7 @@ export default function PreviewWindow({
|
|||||||
|
|
||||||
<PreviewButton
|
<PreviewButton
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
navigator.clipboard.writeText(`http://localhost:5173`)
|
navigator.clipboard.writeText(`${window.location.protocol}//${window.location.hostname}:5173`)
|
||||||
toast.info("Copied preview link to clipboard")
|
toast.info("Copied preview link to clipboard")
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@ -73,7 +73,7 @@ export default function PreviewWindow({
|
|||||||
ref={ref}
|
ref={ref}
|
||||||
width={"100%"}
|
width={"100%"}
|
||||||
height={"100%"}
|
height={"100%"}
|
||||||
src={`http://localhost:5173`}
|
src={`${window.location.protocol}//${window.location.hostname}:5173`}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user