diff --git a/src/backend/mod.rs b/src/backend/mod.rs index ec33bd7..00c1660 100644 --- a/src/backend/mod.rs +++ b/src/backend/mod.rs @@ -39,20 +39,13 @@ pub struct Session { impl Default for Session { fn default() -> Self { Self { - base_url: "https://api.nerdcult.net".to_owned(), + base_url: option_env!("NC_API_URL").unwrap_or("https://api.nerdcult.net").to_string(), auth_token: get_auth_cookie(), } } } impl Session { - pub fn new(base_url: String) -> Self { - Self { - base_url, - auth_token: get_auth_cookie(), - } - } - pub fn login( &self, username: String, diff --git a/src/main.rs b/src/main.rs index f6b13de..53709cc 100644 --- a/src/main.rs +++ b/src/main.rs @@ -43,7 +43,7 @@ pub struct Callbacks { #[function_component] fn App() -> Html { // let state = use_state(Session::default); - let state = use_state(|| Session::new("http://localhost:8080".to_string())); + let state = use_state(Session::default); let cloned_state = state.clone(); let callbacks = use_state(move || Callbacks {