From 92451e1e2ed866e35f1f0612a15f7635e6c96f9d Mon Sep 17 00:00:00 2001 From: Lu Yang Date: Sat, 12 Oct 2024 14:55:00 +0100 Subject: [PATCH] fix login next url --- lapdev-dashboard/src/account.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lapdev-dashboard/src/account.rs b/lapdev-dashboard/src/account.rs index ed17bcb..6f4e64e 100644 --- a/lapdev-dashboard/src/account.rs +++ b/lapdev-dashboard/src/account.rs @@ -19,11 +19,15 @@ pub async fn get_login() -> Result { async fn now_login(provider: AuthProvider) -> Result<()> { let location = use_location(); - let next = format!( - "{}{}", - location.pathname.get_untracked(), - location.search.get_untracked() - ); + let next = format!("{}{}", location.pathname.get_untracked(), { + let search = location.search.get_untracked(); + if search.is_empty() { + "".to_string() + } else { + format!("?{search}") + } + }); + let next = urlencoding::encode(&next).to_string(); let location = window().window().location(); let resp = Request::get("/api/private/session") .query([