Skip to content

Commit 982e304

Browse files
[autofix.ci] apply automated fixes
1 parent da98dc4 commit 982e304

2 files changed

Lines changed: 22 additions & 16 deletions

File tree

src/frontend/src/helpers/get-backend-rootpath.ts

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,43 @@ import fetch from "node-fetch";
22
import { getURL } from "../controllers/API/helpers/constants";
33

44
export async function getBackendRootPath(target: string) {
5-
let rootPath = '';
6-
const configURL = getURL("CONFIG")
5+
let rootPath = "";
6+
const configURL = getURL("CONFIG");
77
try {
8-
console.log('Fetching config from:', `${target}${configURL}`);
8+
console.log("Fetching config from:", `${target}${configURL}`);
99
const response = await fetch(`${target}${configURL}`);
1010
if (!response.ok) {
11-
console.warn(`Failed to fetch config: ${response.status}, using empty root path`);
12-
return '';
11+
console.warn(
12+
`Failed to fetch config: ${response.status}, using empty root path`,
13+
);
14+
return "";
1315
}
1416

1517
const data = await response.json();
16-
if (!data || typeof data.root_path !== 'string') {
17-
console.warn('Invalid config response: root_path is missing or invalid, using empty root path');
18-
return '';
18+
if (!data || typeof data.root_path !== "string") {
19+
console.warn(
20+
"Invalid config response: root_path is missing or invalid, using empty root path",
21+
);
22+
return "";
1923
}
2024

2125
rootPath = data.root_path;
22-
console.log('Using root path:', rootPath);
26+
console.log("Using root path:", rootPath);
2327

2428
// Set the environment variable
2529
process.env.ROOT_PATH = rootPath;
2630

2731
// Verify it was set correctly
2832
if (process.env.ROOT_PATH !== rootPath) {
29-
console.warn('Failed to set ROOT_PATH environment variable, using empty root path');
30-
return '';
33+
console.warn(
34+
"Failed to set ROOT_PATH environment variable, using empty root path",
35+
);
36+
return "";
3137
}
3238
} catch (error) {
33-
console.warn('Failed to fetch or set backend config:', error);
34-
console.warn('Using empty root path');
35-
return '';
39+
console.warn("Failed to fetch or set backend config:", error);
40+
console.warn("Using empty root path");
41+
return "";
3642
}
3743
return rootPath;
3844
}

src/frontend/src/routes.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ const PlaygroundPage = lazy(() => import("./pages/Playground"));
4545
const SignUp = lazy(() => import("./pages/SignUpPage"));
4646

4747
// Get root path from environment variable set by Vite
48-
const rootPath = process.env.ROOT_PATH || '';
48+
const rootPath = process.env.ROOT_PATH || "";
4949

5050
// Log the root path being used
51-
console.log('Using root path in routes:', rootPath || '(empty)');
51+
console.log("Using root path in routes:", rootPath || "(empty)");
5252

5353
const router = createBrowserRouter(
5454
createRoutesFromElements([

0 commit comments

Comments
 (0)