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 = { | ||||
|     baseUrl: | ||||
|         window.location.hostname === "localhost" && !(window.location.port === "80" || window.location.port === "") | ||||
|             ? "http://localhost:3000/api" | ||||
|             : window.location.origin + "/api", | ||||
|     baseUrl: ((): string => { | ||||
|         if (import.meta.env.VITE_API_BASE_URL) { | ||||
|             return import.meta.env.VITE_API_BASE_URL; | ||||
|         } | ||||
| 
 | ||||
|         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"; | ||||
|  |  | |||
		Reference in a new issue