From 64069496728a0f6d62d936a7f03f156e7775f287 Mon Sep 17 00:00:00 2001 From: Astitva Patle Date: Tue, 8 Oct 2024 20:22:52 +0530 Subject: [PATCH] feat: added method in url [] --- src/pages/Auth/login-page/LoginPage.svelte | 4 ++-- src/pages/Auth/oauth-redirect/OauthRedirect.svelte | 2 +- src/pages/Auth/verify-email/VerifyEmail.svelte | 6 +++--- src/pages/Auth/verify-email/verify-email.ts | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/pages/Auth/login-page/LoginPage.svelte b/src/pages/Auth/login-page/LoginPage.svelte index 2000e91..bfd1451 100644 --- a/src/pages/Auth/login-page/LoginPage.svelte +++ b/src/pages/Auth/login-page/LoginPage.svelte @@ -100,8 +100,8 @@ isLogin = true; 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`; + const sparrowRedirect = `sparrow://?accessToken=${accessToken}&refreshToken=${refreshToken}&response=${JSON.stringify(response)}&event=login&method=email`; + const sparrowWebRedirect = constants.SPARROW_WEB_URL +`?accessToken=${accessToken}&refreshToken=${refreshToken}&response=${JSON.stringify(response)}&event=login&method=email`; if(userFromDesktop === "true"){ setTimeout(() => { let data = JSON.parse(window.atob(accessToken?.split('.')[1])); diff --git a/src/pages/Auth/oauth-redirect/OauthRedirect.svelte b/src/pages/Auth/oauth-redirect/OauthRedirect.svelte index 7a4d3df..8ce16c4 100644 --- a/src/pages/Auth/oauth-redirect/OauthRedirect.svelte +++ b/src/pages/Auth/oauth-redirect/OauthRedirect.svelte @@ -9,7 +9,7 @@ const accessToken = urlParams.get('accessToken'); const refreshToken = urlParams.get('refreshToken'); const source = urlParams.get('source'); - const sparrowRedirect = `sparrow://?accessToken=${accessToken}&refreshToken=${refreshToken}&event=${source}`; + const sparrowRedirect = `sparrow://?accessToken=${accessToken}&refreshToken=${refreshToken}&event=${source}&method=google`; if (accessToken && refreshToken) { setTimeout(() => { diff --git a/src/pages/Auth/verify-email/VerifyEmail.svelte b/src/pages/Auth/verify-email/VerifyEmail.svelte index ad4c2dc..2cc8956 100644 --- a/src/pages/Auth/verify-email/VerifyEmail.svelte +++ b/src/pages/Auth/verify-email/VerifyEmail.svelte @@ -2,7 +2,7 @@ import lineIcon from '$lib/assets/line.svg'; import starIcon from '$lib/assets/starIcon.svg'; import { errorMessageText, isLoading, username } from '$lib/store/auth.store'; - import { handleVerifyEmail, isSuccessfulResponse } from './verify-email'; + import { handleVerifyUserEmail, isSuccessfulResponse } from './verify-email'; import sparrowicon from '$lib/assets/logoSparrowSquare.svg'; import { writable } from 'svelte/store'; import { onDestroy, onMount } from 'svelte'; @@ -492,12 +492,12 @@ loader={verifyCodeLoader} onClick={async () => { verifyCodeLoader = true; - let response = await handleVerifyEmail(verifyCodeCredential); + let response = await handleVerifyUserEmail(verifyCodeCredential); if (response?.isSuccessful) { isRegistered = true; const accessToken = response?.data.accessToken?.token; const refreshToken = response?.data.refreshToken?.token; - const sparrowRedirect = `sparrow://?accessToken=${accessToken}&refreshToken=${refreshToken}&response=${JSON.stringify(response.data)}&event=register`; + const sparrowRedirect = `sparrow://?accessToken=${accessToken}&refreshToken=${refreshToken}&response=${JSON.stringify(response.data)}&event=register&method=email`; setTimeout(() => { let data = JSON.parse(window.atob(accessToken?.split('.')[1])); redirectRules.title = `Welcome ${data.name.split(' ')[0]}`; diff --git a/src/pages/Auth/verify-email/verify-email.ts b/src/pages/Auth/verify-email/verify-email.ts index 315174b..e716a67 100644 --- a/src/pages/Auth/verify-email/verify-email.ts +++ b/src/pages/Auth/verify-email/verify-email.ts @@ -5,7 +5,7 @@ export const isSuccessfulResponse = writable(false); import { writable } from 'svelte/store'; -export const handleVerifyEmail = async (verifyCodeCredential: verifyPostbody) => { +export const handleVerifyUserEmail = async (verifyCodeCredential: verifyPostbody) => { const response = await verifyUserEmail(verifyCodeCredential); if (response.isSuccessful) { errorMessageText.set("");