File tree Expand file tree Collapse file tree
dashboard-frontend/src/services Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,7 +10,15 @@ declare global {
1010 }
1111}
1212
13- const API_BASE = import . meta. env . VITE_API_URL || "http://localhost:5003" ;
13+ const getBaseUrl = ( port : number ) => {
14+ if ( typeof window !== "undefined" ) {
15+ return `http://${ window . location . hostname } :${ port } ` ;
16+ }
17+ return `http://localhost:${ port } ` ;
18+ } ;
19+
20+ const API_BASE = import . meta. env . VITE_API_URL || getBaseUrl ( 5003 ) ;
21+ const PRODUCER_BASE = getBaseUrl ( 5001 ) ;
1422
1523interface JobResponse {
1624 id ?: string ;
@@ -114,7 +122,7 @@ export const getCompletedJobs = async (): Promise<CompletedJobsResponse> => {
114122// Submit New Job
115123export const submitReport = async ( reportType : string , data : object ) => {
116124 const response = await axios . post (
117- "http://localhost:5001/ api/v1/reports/generate" ,
125+ ` ${ PRODUCER_BASE } / api/v1/reports/generate` ,
118126 { reportType, data } ,
119127 { headers : { "Content-Type" : "application/json" } }
120128 ) ;
Original file line number Diff line number Diff line change @@ -62,7 +62,6 @@ services:
6262 ports : [ "5004:5004" ]
6363 environment :
6464 - FRONTEND_PORT=5004
65- - VITE_API_URL=http://localhost:5003
6665 - NODE_ENV=production
6766 depends_on : [ dashboard-api ]
6867
You can’t perform that action at this time.
0 commit comments