fix android serverfns (#3231)

This commit is contained in:
Jonathan Kelley authored and GitHub committed 2024-11-17 01:57:13 -05:00
1 parent 493c5c7532
commit 31d72db82d
1 file changed
+7 -1
+7 -1
View File
@@ -159,8 +159,14 @@ impl LaunchBuilder {
{
use dioxus_fullstack::prelude::server_fn::client::{get_server_url, set_server_url};
if get_server_url().is_empty() {
let ip = if cfg!(target_os = "android") {
"10.0.2.2"
} else {
"127.0.0.1"
};
let serverurl = format!(
"http://127.0.0.1:{}",
"http://{ip}:{}",
std::env::var("PORT").unwrap_or_else(|_| "8080".to_string())
)
.leak();