Skip to content

Commit 6cc68ba

Browse files
authored
fix: Demo switch version (#155)
1 parent c3fdf5f commit 6cc68ba

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

demo/src/components/switch_version.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ pub fn SwitchVersion() -> impl IntoView {
1717
cfg_if::cfg_if! {
1818
if #[cfg(any(feature = "csr", feature = "hydrate"))] {
1919
let location = window().location();
20-
let host = location.host().ok();
21-
let version = RwSignal::new(host);
22-
let _ = version.watch(move |host| {
23-
if let Some(host) = host {
20+
let origin = location.origin().ok();
21+
let version = RwSignal::new(origin);
22+
let _ = version.watch(move |origin| {
23+
if let Some(origin) = origin {
2424
let pathname = location.pathname().unwrap_or_default();
25-
let href = format!("{}{}", host, pathname);
25+
let href = format!("{}{}", origin, pathname);
2626
let _ = location.set_href(&href);
2727
}
2828
});

0 commit comments

Comments
 (0)