diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib.rs | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/lib.rs b/src/lib.rs index a884201..45f6e90 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -21,12 +21,16 @@ mod api; mod components; mod pages; -use leptos::prelude::{AddAnyAttr, IntoView, component, provide_context, view}; +use leptos::{ + prelude::{AddAnyAttr, IntoView, component, provide_context, view}, + tachys::dom::document, +}; use leptos_meta::{Html, Meta, Title, provide_meta_context}; use leptos_router::{ components::{Route, Router, Routes}, path, }; +use log::error; use reactive_stores::Store; use rocie_client::apis::configuration::Configuration; @@ -52,7 +56,19 @@ pub fn App() -> impl IntoView { let mut config = Configuration::new(); config.user_agent = Some("rocie-mobile".to_owned()); - "/api/".clone_into(&mut config.base_path); + + let document = document(); + format!( + "{}/api", + document + .query_selector("div#location-storage") + .expect("This part is defined in the index.html") + .expect("This part is really defined in the index.html") + .get_attribute("location") + .expect("This was set in the index.html") + .trim_end_matches('/') + ) + .clone_into(&mut config.base_path); config }; |
