From dac70496bc82959e4a95d47dded986818f30ca2e Mon Sep 17 00:00:00 2001 From: Md Asif Raza Date: Tue, 1 Oct 2024 19:38:33 +0530 Subject: [PATCH] feat: implement redirect rule to sparrow web --- src/App.svelte | 1 + src/pages/Auth/login-page/LoginPage.svelte | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/App.svelte b/src/App.svelte index 6adde32..fb17cb9 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -25,6 +25,7 @@ // Check the query parameters in the URL const urlParams = new URLSearchParams(window.location.search); const source = urlParams.get('source'); // Get 'source' from query param + if(!source) return; if (source === 'web') { localStorage.setItem('isUserFromDesktop', 'false'); diff --git a/src/pages/Auth/login-page/LoginPage.svelte b/src/pages/Auth/login-page/LoginPage.svelte index eaa6cda..2000e91 100644 --- a/src/pages/Auth/login-page/LoginPage.svelte +++ b/src/pages/Auth/login-page/LoginPage.svelte @@ -101,7 +101,7 @@ const accessToken = response?.accessToken?.token; const refreshToken = response?.refreshToken?.token; const sparrowRedirect = `sparrow://?accessToken=${accessToken}&refreshToken=${refreshToken}&response=${JSON.stringify(response)}&event=login`; - + const sparrowWebRedirect = constants.SPARROW_WEB_URL +`?accessToken=${accessToken}&refreshToken=${refreshToken}&response=${JSON.stringify(response)}&event=login`; if(userFromDesktop === "true"){ setTimeout(() => { let data = JSON.parse(window.atob(accessToken?.split('.')[1])); @@ -119,7 +119,7 @@ } else{ - navigate(constants.SPARROW_WEB_URL); + navigate(sparrowWebRedirect); } } else { localStorage.setItem(`timer-verify-${loginCredentials.email}`, new Date().getTime());