mirror of
https://github.com/hulthe/inkopslista.git
synced 2026-08-03 23:11:28 +02:00
gui-web: Use the document url as the the API url
This commit is contained in:
+9
-3
@@ -96,12 +96,18 @@ pub fn run() -> Result<(), anyhow::Error> {
|
||||
.inspect_err(|err| eprintln!("{err:?}"))
|
||||
.unwrap_or_default();
|
||||
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
let conf = Config::default();
|
||||
|
||||
#[cfg(target_os = "android")]
|
||||
let conf = Config::default();
|
||||
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
let mut conf = Config::default();
|
||||
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
web_sys::window()
|
||||
.and_then(|window| window.document())
|
||||
.and_then(|document| document.url().ok())
|
||||
.map(|url| conf.address = url);
|
||||
|
||||
state.set_server_address(conf.address.to_shared_string());
|
||||
let conf_shared = Arc::new(Mutex::new(conf));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user