chore(dx): custom debug host
Signed-off-by: Innei <tukon479@gmail.com>
This commit is contained in:
parent
6704d61baa
commit
a60db7eda6
|
|
@ -2,7 +2,24 @@
|
|||
<html>
|
||||
<head>
|
||||
<script type="module">
|
||||
const host = "https://localhost:2233"
|
||||
const searchParams = new URLSearchParams(window.location.search)
|
||||
const debugHost = searchParams.get("debug-host")
|
||||
|
||||
const resetSessionStorage = () => {
|
||||
sessionStorage.removeItem("debug-host")
|
||||
}
|
||||
|
||||
const resetParams = searchParams.delete("debug-host")
|
||||
if (resetParams) {
|
||||
resetSessionStorage()
|
||||
}
|
||||
|
||||
const debugHostInSessionStorage = sessionStorage.getItem("debug-host")
|
||||
|
||||
const host = debugHost || debugHostInSessionStorage || "https://localhost:2233"
|
||||
if (debugHost) {
|
||||
sessionStorage.setItem("debug-host", debugHost)
|
||||
}
|
||||
|
||||
const createRefreshRuntimeScript = `
|
||||
import RefreshRuntime from "${host}/@react-refresh";
|
||||
|
|
|
|||
|
|
@ -63,8 +63,4 @@ injectEnv({"VITE_API_URL":"${apiUrl}","VITE_EXTERNAL_API_URL":"${apiUrl}","VITE_
|
|||
document.head.prepend($script)
|
||||
}
|
||||
|
||||
const apiMap = {
|
||||
"https://dev.follow.is": "https://api.dev.follow.is",
|
||||
"https://app.follow.is": "https://api.follow.is",
|
||||
}
|
||||
injectScript(apiMap[window.location.origin])
|
||||
injectScript(import.meta.env.VITE_API_URL)
|
||||
|
|
|
|||
Loading…
Reference in New Issue