Skip to content

Commit

Permalink
feat: implement redirect rule to sparrow web
Browse files Browse the repository at this point in the history
  • Loading branch information
itsmdasifraza committed Oct 1, 2024
1 parent a9ac451 commit dac7049
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
4 changes: 2 additions & 2 deletions src/pages/Auth/login-page/LoginPage.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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]));
Expand All @@ -119,7 +119,7 @@

}
else{
navigate(constants.SPARROW_WEB_URL);
navigate(sparrowWebRedirect);
}
} else {
localStorage.setItem(`timer-verify-${loginCredentials.email}`, new Date().getTime());
Expand Down

0 comments on commit dac7049

Please sign in to comment.