frontend: use TRUNK_PUBLIC_URL

This commit is contained in:
2025-03-26 12:11:48 +03:00
parent 807ead7dc7
commit 4d8c4d502b
2 changed files with 11 additions and 3 deletions

View File

@@ -37,8 +37,15 @@ pub enum Route {
}
lazy_static! {
static ref API_BASE_URL: String =
std::env::var("API_BASE_URL").unwrap_or("http://127.0.0.1:8000/api/v1".into());
static ref API_BASE_URL: String = option_env!("API_BASE_URL")
.unwrap_or(
(option_env!("TRUNK_PUBLIC_URL")
.unwrap_or("http://127.0.0.1:8000/")
.to_string()
+ "api/v1")
.as_str(),
)
.to_owned();
}
pub struct APIEndpoints {}