Skip to content

Commit 9112ccd

Browse files
code clean up
1 parent 9b4016b commit 9112ccd

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/lib/httpClient.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ export default class httpClient {
2222

2323
let proxyUrl = null;
2424
try {
25-
proxyUrl = SMARTUI_API_PROXY ? new URL(SMARTUI_API_PROXY) : null;
25+
// Handle URL with or without protocol
26+
const urlStr = SMARTUI_API_PROXY?.startsWith('http') ?
27+
SMARTUI_API_PROXY : `http://${SMARTUI_API_PROXY}`;
28+
proxyUrl = SMARTUI_API_PROXY ? new URL(urlStr) : null;
2629
} catch (error) {
2730
console.error('Invalid proxy URL:', error);
2831
}
@@ -40,7 +43,6 @@ export default class httpClient {
4043
});
4144
}
4245

43-
console.log('Axios Config:', JSON.stringify(axiosConfig, null, 2));
4446
this.axiosInstance = axios.create(axiosConfig);
4547

4648

0 commit comments

Comments
 (0)