mirror of
https://github.com/adoyle0/thaw.git
synced 2025-02-02 08:34:15 -05:00
fix: Demo switch version (#155)
This commit is contained in:
parent
c3fdf5fcb0
commit
6cc68ba398
1 changed files with 5 additions and 5 deletions
|
@ -17,12 +17,12 @@ pub fn SwitchVersion() -> impl IntoView {
|
|||
cfg_if::cfg_if! {
|
||||
if #[cfg(any(feature = "csr", feature = "hydrate"))] {
|
||||
let location = window().location();
|
||||
let host = location.host().ok();
|
||||
let version = RwSignal::new(host);
|
||||
let _ = version.watch(move |host| {
|
||||
if let Some(host) = host {
|
||||
let origin = location.origin().ok();
|
||||
let version = RwSignal::new(origin);
|
||||
let _ = version.watch(move |origin| {
|
||||
if let Some(origin) = origin {
|
||||
let pathname = location.pathname().unwrap_or_default();
|
||||
let href = format!("{}{}", host, pathname);
|
||||
let href = format!("{}{}", origin, pathname);
|
||||
let _ = location.set_href(&href);
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue