Skip to content

Commit

Permalink
feat: added method in url []
Browse files Browse the repository at this point in the history
  • Loading branch information
Astitva877 committed Oct 8, 2024
1 parent 7c77cc1 commit 6406949
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
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 @@ -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]));
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Auth/oauth-redirect/OauthRedirect.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down
6 changes: 3 additions & 3 deletions src/pages/Auth/verify-email/VerifyEmail.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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]}`;
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Auth/verify-email/verify-email.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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("");
Expand Down

0 comments on commit 6406949

Please sign in to comment.