chore(frontend): Configureerbare API URL
This commit is contained in:
		
							parent
							
								
									04ac71dbed
								
							
						
					
					
						commit
						2d5988552f
					
				
					 1 changed files with 12 additions and 4 deletions
				
			
		|  | @ -1,8 +1,16 @@ | ||||||
| export const apiConfig = { | export const apiConfig = { | ||||||
|     baseUrl: |     baseUrl: ((): string => { | ||||||
|         window.location.hostname === "localhost" && !(window.location.port === "80" || window.location.port === "") |         if (import.meta.env.VITE_API_BASE_URL) { | ||||||
|             ? "http://localhost:3000/api" |             return import.meta.env.VITE_API_BASE_URL; | ||||||
|             : window.location.origin + "/api", |         } | ||||||
|  | 
 | ||||||
|  |         if (window.location.hostname === "localhost" && !(window.location.port === "80" || window.location.port === "")) { | ||||||
|  |             return "http://localhost:3000/api"; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         // Fallback to the current origin with "/api" suffix
 | ||||||
|  |         return `${window.location.origin}/api`; | ||||||
|  |     })(), | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| export const loginRoute = "/login"; | export const loginRoute = "/login"; | ||||||
|  |  | ||||||
		Reference in a new issue