use super::RouteDef;
use std::sync::Arc;
use web_sys::window;
#[derive(Clone)]
pub struct Router {
#[allow(unused)]
router: Arc<actix_router::Router<RouteDef>>,
}
impl Default for Router {
fn default() -> Self {
let builder = actix_router::Router::build();
let router = Arc::new(builder.finish());
Self { router }
}
}
impl Router {
pub fn new() -> Self {
Self::default()
}
pub fn init(&self) -> anyhow::Result<()> {
let _href = window()
.and_then(|win| win.location().href().ok())
.expect("Could not access window location");
web_sys::console::log_1(&"Initialized router".into());
Ok(())
}
}