mirror of
https://github.com/logos-storage/logos-storage-marketplace-ui.git
synced 2026-01-04 06:23:08 +00:00
Add api-port get parameter to update the port settings
This commit is contained in:
parent
48de6f06d0
commit
db3227213b
43
src/main.tsx
43
src/main.tsx
@ -21,6 +21,7 @@ import { SettingsRoute } from "./routes/dashboard/settings.tsx";
|
|||||||
import { HelpRoute } from "./routes/dashboard/help.tsx";
|
import { HelpRoute } from "./routes/dashboard/help.tsx";
|
||||||
import { DisclaimerRoute } from "./routes/dashboard/disclaimer.tsx";
|
import { DisclaimerRoute } from "./routes/dashboard/disclaimer.tsx";
|
||||||
import { RouteErrorBoundary } from "./components/RouteErrorBoundary/RouteErrorBoundary.tsx";
|
import { RouteErrorBoundary } from "./components/RouteErrorBoundary/RouteErrorBoundary.tsx";
|
||||||
|
import { HealthCheckUtils } from "./components/HealthChecks/health-check.utils.ts";
|
||||||
|
|
||||||
if (import.meta.env.PROD && !import.meta.env.CI) {
|
if (import.meta.env.PROD && !import.meta.env.CI) {
|
||||||
Sentry.init({
|
Sentry.init({
|
||||||
@ -117,14 +118,36 @@ const queryClient = new QueryClient();
|
|||||||
const rootElement = document.getElementById("root")!;
|
const rootElement = document.getElementById("root")!;
|
||||||
|
|
||||||
if (rootElement) {
|
if (rootElement) {
|
||||||
CodexSdk.load().then(() => {
|
CodexSdk.load()
|
||||||
render(
|
.then(() => {
|
||||||
<StrictMode>
|
const queryString = window.location.search;
|
||||||
<QueryClientProvider client={queryClient}>
|
if (queryString) {
|
||||||
<RouterProvider router={router} />
|
const urlParams = new URLSearchParams(queryString);
|
||||||
</QueryClientProvider>
|
const param = urlParams.get("api-port");
|
||||||
</StrictMode>,
|
if (param) {
|
||||||
rootElement
|
const port = parseInt(param, 10);
|
||||||
);
|
if (!isNaN(port)) {
|
||||||
});
|
const address = HealthCheckUtils.removePort(CodexSdk.url());
|
||||||
|
|
||||||
|
const url = address + ":" + port;
|
||||||
|
|
||||||
|
if (HealthCheckUtils.isUrlInvalid(url)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return CodexSdk.updateURL(url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
render(
|
||||||
|
<StrictMode>
|
||||||
|
<QueryClientProvider client={queryClient}>
|
||||||
|
<RouterProvider router={router} />
|
||||||
|
</QueryClientProvider>
|
||||||
|
</StrictMode>,
|
||||||
|
rootElement
|
||||||
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user