From 988b9ede1d69dc3e3663b04f4165f8204d793450 Mon Sep 17 00:00:00 2001 From: nishihere19 Date: Sat, 25 Dec 2021 20:36:41 +0530 Subject: [PATCH 1/8] add: bootstrap and ui changes Signed-off-by: nishihere19 --- src/App.svelte | 11 ++-------- src/ThemeContext.svelte | 10 ++++----- src/routes/Dashboard.svelte | 44 +++++++++++-------------------------- 3 files changed, 20 insertions(+), 45 deletions(-) diff --git a/src/App.svelte b/src/App.svelte index 756323b..018f52b 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -96,10 +96,7 @@ integrity="sha512-gxWow8Mo6q6pLa1XH/CcH8JyiSDEtiwJV78E+D+QP0EVasFs8wKXq16G8CLD4CJ2SnonHr4Lm/yY2fSI2+cbmw==" crossorigin="anonymous" /> - +
- {#await getUserDetails()} -
- {:then userInfo} -
- Profile -
- {#if userInfo && userInfo.email} -

{userInfo.email.email.substring(0, userInfo.email.email.length - 9)}

- {/if} -
-
- {userInfo.name} -
-
-
- {#if userInfo.batch && userInfo.batch != 'NULL'} - {userInfo.batch} - {/if} -
- {userInfo.phoneNumber}
- {#if userInfo.gender && userInfo.gender != 'NONE'} - {userInfo.gender} - {/if} -
-
- +
+ Profile +
+ {#if userInfo && userInfo.email} +

{userInfo.email.email.substring(0, userInfo.email.email.length - 9)}

+ {/if} +
+
+ {userInfo.name}
{/await}
From 38237c082949d790dd86c8ab223e9e6fda0b3a93 Mon Sep 17 00:00:00 2001 From: nishihere19 Date: Thu, 17 Mar 2022 15:27:51 +0530 Subject: [PATCH 2/8] add: batch details for a user Signed-off-by: nishihere19 --- src/App.svelte | 2 + src/routes/AddBatch.svelte | 110 ++++++++++++++++++++++++ src/routes/Dashboard.svelte | 15 +++- src/routes/EditProfile.svelte | 119 +++++++++++++++++++------- src/routes/Redirect.svelte | 27 ++++++ src/routes/RegistrationDetails.svelte | 99 ++++++++++++++------- 6 files changed, 307 insertions(+), 65 deletions(-) create mode 100644 src/routes/AddBatch.svelte diff --git a/src/App.svelte b/src/App.svelte index 018f52b..4b2f536 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -41,6 +41,7 @@ } from '@mdi/js'; import PasswordReset from './routes/PasswordReset.svelte'; import EditProfile from './routes/EditProfile.svelte'; + import AddBatch from './routes/AddBatch.svelte'; let isauth = ''; let url = ''; @@ -167,6 +168,7 @@ + {#if $auth == 'true'} diff --git a/src/routes/AddBatch.svelte b/src/routes/AddBatch.svelte new file mode 100644 index 0000000..c229621 --- /dev/null +++ b/src/routes/AddBatch.svelte @@ -0,0 +1,110 @@ + + + + +
+ {#await getBatches()} +
Loading..
+ {:then batches} +
+
Please add your batch details
+ +
+
+
+ +
+
+ {/await} +
diff --git a/src/routes/Dashboard.svelte b/src/routes/Dashboard.svelte index 33a5fba..c7d35a7 100644 --- a/src/routes/Dashboard.svelte +++ b/src/routes/Dashboard.svelte @@ -110,5 +110,18 @@
{userInfo.name}
- {/await} +
+
+ {#if userInfo.batch && userInfo.batch != 'NA'} + {userInfo.batch} + {/if} +
+ {userInfo.phoneNumber}
+ {#if userInfo.gender && userInfo.gender != 'NONE'} + {userInfo.gender} + {/if} +
+
+ + diff --git a/src/routes/EditProfile.svelte b/src/routes/EditProfile.svelte index aa0a136..a4cd0ea 100644 --- a/src/routes/EditProfile.svelte +++ b/src/routes/EditProfile.svelte @@ -47,6 +47,16 @@ { name: 'MALE', value: 'MALE' }, { name: 'FEMALE', value: 'FEMALE' } ]; + + let batches=[]; + async function getBatches() { + let result = await axiosInstance({ + method: 'get', + url: `${config.backendurl}/auth/batches` + }); + batches = result.data; + return batches; + } let batches = []; async function getBatches() { @@ -72,6 +82,7 @@ userInfo = userDetails; }); fetchUserData(); + console.log(userInfo) }); function save() { @@ -107,7 +118,7 @@ name: userInfo.name.toString(), gender: userInfo.gender.toString(), phoneNumber: userInfo.phoneNumber.toString(), - batch: userInfo.batch.toString() + batch:userInfo.batch.toString() }, headers: { 'Content-Type': 'application/json' } }) @@ -163,38 +174,79 @@
{#await getBatches()} -
Loading..
- {:then batches} -
-
-
Please enter your profile details completely!
-
-
-
-
- -
-
-
- -
-
+
+ +
+
+
+ +
+
+ +
+
+
+ + {#if $theme.name == 'dark'} + {#each batches as batch} @@ -250,5 +302,6 @@ {/if}
+ {/await}
diff --git a/src/routes/Redirect.svelte b/src/routes/Redirect.svelte index 63a4238..86c43df 100644 --- a/src/routes/Redirect.svelte +++ b/src/routes/Redirect.svelte @@ -15,21 +15,47 @@ import config from '../../env'; import { axiosInstance } from '../utils/axios'; import { getContext, onMount } from 'svelte'; + import user from '../utils/user'; + import { fetchUserData } from '../utils/user'; let { theme } = getContext('theme'); //get all fields from query params let finalParams = searchQuery(); onMount(() => { +<<<<<<< HEAD +======= + +>>>>>>> 43f8f58 (add: batch details for a user) //handle nav bar visibility depending on screen size (hiding nav bar because loader page) let element: HTMLBodyElement = document.querySelector('.navbar'); if (!element) element = document.querySelector('.appbar'); element.style.display = 'none'; + //to save userInfo in user store + let userInfo: any = {}; authorizeSession.set(true); + //get all fields from query params + let finalParams = searchQuery(); + //in case the user is logged in if ($auth == 'true') { + + //get user info + user.subscribe(userDetails => { + userInfo = userDetails; + }); + + //fetch user data + fetchUserData(); + + if(userInfo.batch=="NA"){ + localStorage.setItem('Dauth_params', finalParams); + navigate(`/addBatch?${finalParams}`, { replace: true }); + } + else{ + localStorage.removeItem('Dauth_params'); axiosInstance({ method: 'get', url: `${config.backendurl}/oauth/authorize`, @@ -87,6 +113,7 @@ }); navigate(`/`, { replace: true }); }); + } } else { localStorage.setItem('Dauth_params', finalParams); navigate(`/?${finalParams}`, { replace: true }); diff --git a/src/routes/RegistrationDetails.svelte b/src/routes/RegistrationDetails.svelte index 7a5c3dc..3420df3 100644 --- a/src/routes/RegistrationDetails.svelte +++ b/src/routes/RegistrationDetails.svelte @@ -68,7 +68,7 @@ gender: '', password: '', confirmPassword: '', - batch: '' + batch:'' }; const items = [ { name: 'MALE', value: 'MALE' }, @@ -119,8 +119,8 @@ gender: state.gender.toString(), password: state.password.toString(), repeatPassword: state.confirmPassword.toString(), - phoneNumber: state.phone.toString(), - batch: state.batch + phoneNumber: phoneInput.getNumber(), + batch:state.batch }, headers: { 'Content-Type': 'application/json' } }) @@ -159,28 +159,28 @@ {#await getBatches()}
Loading..
{:then batches} -
- - -
-
-
Please enter the details to create an account!
-
-
-
-
- { - handleChange(e); - }} - />
-
- +
+
+
Please enter the details to create an account!
+
+
+
+
+ { + handleChange(e); + }} + />
+
+ +
-->


- -
-
+
+
- Submit
diff --git a/src/routes/Dashboard.svelte b/src/routes/Dashboard.svelte index c7d35a7..5af44e0 100644 --- a/src/routes/Dashboard.svelte +++ b/src/routes/Dashboard.svelte @@ -92,6 +92,11 @@ navigate('/', { replace: true }); } }); + user.subscribe(userDetails => { + userInfo = userDetails; + }); + fetchUserData(); + console.log(userInfo) }); @@ -115,7 +120,7 @@ {#if userInfo.batch && userInfo.batch != 'NA'} {userInfo.batch} {/if} -
+
{userInfo.phoneNumber}
{#if userInfo.gender && userInfo.gender != 'NONE'} {userInfo.gender} diff --git a/src/routes/EditProfile.svelte b/src/routes/EditProfile.svelte index a4cd0ea..8f6c5bf 100644 --- a/src/routes/EditProfile.svelte +++ b/src/routes/EditProfile.svelte @@ -47,8 +47,8 @@ { name: 'MALE', value: 'MALE' }, { name: 'FEMALE', value: 'FEMALE' } ]; - - let batches=[]; + + let batches = []; async function getBatches() { let result = await axiosInstance({ method: 'get', @@ -82,7 +82,7 @@ userInfo = userDetails; }); fetchUserData(); - console.log(userInfo) + console.log(userInfo); }); function save() { @@ -118,7 +118,7 @@ name: userInfo.name.toString(), gender: userInfo.gender.toString(), phoneNumber: userInfo.phoneNumber.toString(), - batch:userInfo.batch.toString() + batch: userInfo.batch.batch.toString() }, headers: { 'Content-Type': 'application/json' } }) @@ -174,85 +174,43 @@
{#await getBatches()} -
Loading..
-{:then batches} -
-
-
-
-
-
- -
-
-
- -
-
- -
-
-
- - {#if $theme.name == 'dark'} - Loading..
+ {:then batches} +
+
+
+
+
+
+ +
+
+
+ +
+
-
--> +
-->
- - {#each batches as batch} - {#if $theme.name == 'dark'} - - {/if} - {#if $theme.name == 'light'} - - {/if} - {/each} -
-
-
- -
-
- {/await} -
diff --git a/src/routes/Dashboard.svelte b/src/routes/Dashboard.svelte index 5af44e0..fa35c79 100644 --- a/src/routes/Dashboard.svelte +++ b/src/routes/Dashboard.svelte @@ -47,40 +47,40 @@ import { auth } from '../utils/auth'; import { mdiAccountEdit } from '@mdi/js'; import { Icon } from 'svelte-materialify'; - import { axiosInstance } from '../utils/axios'; - import config from '../../env'; + import {axiosInstance} from "../utils/axios"; + import config from "../../env" let isauth = 'false'; let userInfo: any = {}; - const getUserDetails = async () => { - await axiosInstance({ - method: 'get', - url: `${config.backendurl}/user/apps`, - headers: { 'Content-Type': 'application/json' } - }) - .then( - (response: { - data: { - apps: { - id: string; - name: string; - description: string; - icon: string; - redirect_url: string; - created_at: string; - updated_at: string; - }[]; - }; - }) => { - userInfo = response.data; - } - ) - .catch(error => { - return {}; - }); + const getUserDetails = async () =>{ + await axiosInstance({ + method: 'get', + url: `${config.backendurl}/user/apps`, + headers: { 'Content-Type': 'application/json' } + }) + .then( + (response: { + data: { + apps: { + id: string; + name: string; + description: string; + icon: string; + redirect_url: string; + created_at: string; + updated_at: string; + }[]; + }; + }) => { + userInfo = response.data; + } + ) + .catch(error => { + return {} + }); return userInfo; - }; + } onMount(() => { let element: HTMLBodyElement = document.querySelector('.navbar'); @@ -92,15 +92,14 @@ navigate('/', { replace: true }); } }); - user.subscribe(userDetails => { - userInfo = userDetails; - }); - fetchUserData(); - console.log(userInfo) + });
+ {#await getUserDetails() } +
+ {:then userInfo}
+ {/await}
diff --git a/src/routes/EditProfile.svelte b/src/routes/EditProfile.svelte index 8f6c5bf..ea31739 100644 --- a/src/routes/EditProfile.svelte +++ b/src/routes/EditProfile.svelte @@ -41,6 +41,12 @@ let isauth = 'false'; +<<<<<<< HEAD +======= + //get all fields from query params + let finalParams:any = searchQuery(); + +>>>>>>> c2c8958 (fixes: batch details for a user) let { theme } = getContext('theme'); let userInfo: any = {}; const items = [ @@ -82,7 +88,6 @@ userInfo = userDetails; }); fetchUserData(); - console.log(userInfo); }); function save() { @@ -95,7 +100,12 @@ userInfo.gender.length != 0 && userInfo.gender != 'NONE' && userInfo.batch && +<<<<<<< HEAD userInfo.batch.toString().length != 0 +======= + userInfo.batch.batch && + userInfo.batch.batch.toString().length!=0 +>>>>>>> c2c8958 (fixes: batch details for a user) ) { let phno = userInfo.phoneNumber.toString(); let number: number = phno.substring(1, phno.length); @@ -139,6 +149,10 @@ showProgress: true, theme: $theme.name }); + + //if the user came through redirect, take it to authorization page + if(finalParams.substr(10,4)!="null") + navigate(`/redirect?${finalParams}`, { replace: true }); }) .catch(error => { toasts.add({ @@ -168,7 +182,10 @@ } function discard() { - navigate('/dashboard', { replace: true }); + if(finalParams.substr(10,4)!="null") + navigate(`/redirect?${finalParams}`, { replace: true }); + else + navigate('/dashboard', { replace: true }); } @@ -178,6 +195,7 @@ {:then batches}
+
Please enter your profile details completely!


{ + await axiosInstance({ + method: 'get', + url: `${config.backendurl}/user/apps`, + headers: { 'Content-Type': 'application/json' } + }) + .then( + (response: { + data: { + apps: { + id: string; + name: string; + description: string; + icon: string; + redirect_url: string; + created_at: string; + updated_at: string; + }[]; + }; + }) => { + userInfo = response.data; + } + ) + .catch(error => { + return {}; + }); + return userInfo; + }; + //get all fields from query params let finalParams = searchQuery(); - onMount(() => { + onMount(async () => { //handle nav bar visibility depending on screen size (hiding nav bar because loader page) let element: HTMLBodyElement = document.querySelector('.navbar'); if (!element) element = document.querySelector('.appbar'); element.style.display = 'none'; - //to save userInfo in user store - let userInfo: any = {}; authorizeSession.set(true); - //get all fields from query params - let finalParams = searchQuery(); - //in case the user is logged in if ($auth == 'true') { - - //get user info - user.subscribe(userDetails => { - userInfo = userDetails; - }); - - //fetch user data - fetchUserData(); - - if(userInfo.batch=="NA"){ - localStorage.setItem('Dauth_params', finalParams); - navigate(`/addBatch?${finalParams}`, { replace: true }); - } - else{ - localStorage.removeItem('Dauth_params'); + userInfo = await getUserDetails(); + + //check if the batch details exist or not, if not, redirect to edit profile page. + if (userInfo.batch == 'NULL' || userInfo.batch == null ||userInfo.batch=='null' || userInfo.batch.length==0) { + localStorage.setItem('Dauth_params', finalParams); + navigate(`/editProfile?${finalParams}`, { replace: true }); + localStorage.removeItem('Dauth_params'); + } + else{ axiosInstance({ method: 'get', url: `${config.backendurl}/oauth/authorize`, diff --git a/src/routes/RegistrationDetails.svelte b/src/routes/RegistrationDetails.svelte index bdba6f7..bcb0b70 100644 --- a/src/routes/RegistrationDetails.svelte +++ b/src/routes/RegistrationDetails.svelte @@ -98,18 +98,18 @@ return; } let phno = state.phone.toString(); - let number: any = phno.substring(1, phno.length); - if (phno[0] != '+' || isNaN(number)) { - toasts.add({ - title: 'Oops!', - description: 'Make sure to add country code and valid phone number', - duration: 10000, // 0 or negative to avoid auto-remove - placement: 'bottom-right', - type: 'error', - showProgress: true, - theme: $theme.name - }); - return; + let number:any = phno.substring(1, phno.length); + if (phno[0] != '+' || isNaN(number)) { + toasts.add({ + title: 'Oops!', + description: 'Make sure to add country code and valid phone number', + duration: 10000, // 0 or negative to avoid auto-remove + placement: 'bottom-right', + type: 'error', + showProgress: true, + theme: $theme.name + }); + return; } else { axiosInstance({ method: 'post', @@ -119,7 +119,7 @@ gender: state.gender.toString(), password: state.password.toString(), repeatPassword: state.confirmPassword.toString(), - phoneNumber: phoneInput.getNumber(), + phoneNumber: state.phone.toString(), batch: state.batch }, headers: { 'Content-Type': 'application/json' } @@ -241,7 +241,6 @@ { - user.set(response.data); + user.set(response.data); } ) - .catch(error => { - user.set({}); + .catch( error => { + user.set({}); }); } From 7d5d3150d3fe08d70f2b8dc434c5ba9f95822402 Mon Sep 17 00:00:00 2001 From: nishihere19 Date: Fri, 1 Apr 2022 23:49:34 +0530 Subject: [PATCH 5/8] fixes: batch details for a user Signed-off-by: nishihere19 --- src/routes/Dashboard.svelte | 116 +++++++++++++------------- src/routes/EditProfile.svelte | 21 ++--- src/routes/Redirect.svelte | 109 +++++++++++++----------- src/routes/RegistrationDetails.svelte | 76 ++++++++--------- src/utils/user.ts | 10 +-- 5 files changed, 170 insertions(+), 162 deletions(-) diff --git a/src/routes/Dashboard.svelte b/src/routes/Dashboard.svelte index fa35c79..8e49f8d 100644 --- a/src/routes/Dashboard.svelte +++ b/src/routes/Dashboard.svelte @@ -47,40 +47,40 @@ import { auth } from '../utils/auth'; import { mdiAccountEdit } from '@mdi/js'; import { Icon } from 'svelte-materialify'; - import {axiosInstance} from "../utils/axios"; - import config from "../../env" + import { axiosInstance } from '../utils/axios'; + import config from '../../env'; let isauth = 'false'; let userInfo: any = {}; - const getUserDetails = async () =>{ - await axiosInstance({ - method: 'get', - url: `${config.backendurl}/user/apps`, - headers: { 'Content-Type': 'application/json' } - }) - .then( - (response: { - data: { - apps: { - id: string; - name: string; - description: string; - icon: string; - redirect_url: string; - created_at: string; - updated_at: string; - }[]; - }; - }) => { - userInfo = response.data; - } - ) - .catch(error => { - return {} - }); + const getUserDetails = async () => { + await axiosInstance({ + method: 'get', + url: `${config.backendurl}/user/apps`, + headers: { 'Content-Type': 'application/json' } + }) + .then( + (response: { + data: { + apps: { + id: string; + name: string; + description: string; + icon: string; + redirect_url: string; + created_at: string; + updated_at: string; + }[]; + }; + }) => { + userInfo = response.data; + } + ) + .catch(error => { + return {}; + }); return userInfo; - } + }; onMount(() => { let element: HTMLBodyElement = document.querySelector('.navbar'); @@ -92,41 +92,41 @@ navigate('/', { replace: true }); } }); - });
- {#await getUserDetails() } -
+ {#await getUserDetails()} +
{:then userInfo} -
- Profile -
- {#if userInfo && userInfo.email} -

{userInfo.email.email.substring(0, userInfo.email.email.length - 9)}

- {/if} -
-
- {userInfo.name} -
-
-
- {#if userInfo.batch && userInfo.batch != 'NA'} - {userInfo.batch} - {/if} +
+ Profile +
+ {#if userInfo && userInfo.email} +

{userInfo.email.email.substring(0, userInfo.email.email.length - 9)}

+ {/if} +
+
+ {userInfo.name} +
+
+
+ {#if userInfo.batch && userInfo.batch != 'NULL'} + {userInfo.batch} + {/if} +
+ {userInfo.phoneNumber}
+ {#if userInfo.gender && userInfo.gender != 'NONE'} + {userInfo.gender} + {/if} +

- {userInfo.phoneNumber}
- {#if userInfo.gender && userInfo.gender != 'NONE'} - {userInfo.gender} - {/if} +
-
- -
{/await}
diff --git a/src/routes/EditProfile.svelte b/src/routes/EditProfile.svelte index ea31739..27b953b 100644 --- a/src/routes/EditProfile.svelte +++ b/src/routes/EditProfile.svelte @@ -41,12 +41,9 @@ let isauth = 'false'; -<<<<<<< HEAD -======= //get all fields from query params - let finalParams:any = searchQuery(); + let finalParams: any = searchQuery(); ->>>>>>> c2c8958 (fixes: batch details for a user) let { theme } = getContext('theme'); let userInfo: any = {}; const items = [ @@ -100,12 +97,17 @@ userInfo.gender.length != 0 && userInfo.gender != 'NONE' && userInfo.batch && +<<<<<<< HEAD <<<<<<< HEAD userInfo.batch.toString().length != 0 ======= userInfo.batch.batch && userInfo.batch.batch.toString().length!=0 >>>>>>> c2c8958 (fixes: batch details for a user) +======= + userInfo.batch && + userInfo.batch.toString().length != 0 +>>>>>>> 6fc6733 (fixes: batch details for a user) ) { let phno = userInfo.phoneNumber.toString(); let number: number = phno.substring(1, phno.length); @@ -128,7 +130,7 @@ name: userInfo.name.toString(), gender: userInfo.gender.toString(), phoneNumber: userInfo.phoneNumber.toString(), - batch: userInfo.batch.batch.toString() + batch: userInfo.batch.toString() }, headers: { 'Content-Type': 'application/json' } }) @@ -151,7 +153,7 @@ }); //if the user came through redirect, take it to authorization page - if(finalParams.substr(10,4)!="null") + if (finalParams.substr(10, 4) != 'null') navigate(`/redirect?${finalParams}`, { replace: true }); }) .catch(error => { @@ -182,10 +184,9 @@ } function discard() { - if(finalParams.substr(10,4)!="null") + if (finalParams.substr(10, 4) != 'null') navigate(`/redirect?${finalParams}`, { replace: true }); - else - navigate('/dashboard', { replace: true }); + else navigate('/dashboard', { replace: true }); } @@ -228,7 +229,7 @@ {#each batches as batch} {#if $theme.name == 'dark'} {batch} {/if} {#if $theme.name == 'light'} diff --git a/src/routes/Redirect.svelte b/src/routes/Redirect.svelte index a766e59..178c03d 100644 --- a/src/routes/Redirect.svelte +++ b/src/routes/Redirect.svelte @@ -62,71 +62,78 @@ //in case the user is logged in if ($auth == 'true') { userInfo = await getUserDetails(); - + //check if the batch details exist or not, if not, redirect to edit profile page. - if (userInfo.batch == 'NULL' || userInfo.batch == null ||userInfo.batch=='null' || userInfo.batch.length==0) { + if ( + userInfo.batch == 'NULL' || + userInfo.batch == null || + userInfo.batch == 'null' || + userInfo.batch.length == 0 + ) { localStorage.setItem('Dauth_params', finalParams); navigate(`/editProfile?${finalParams}`, { replace: true }); localStorage.removeItem('Dauth_params'); - } - else{ - axiosInstance({ - method: 'get', - url: `${config.backendurl}/oauth/authorize`, - headers: { 'Content-Type': 'application/json' }, - params: $params - }) - .then(result => { - const isAuthorized = result.data.isAuthorized; - if (isAuthorized == true) { - document.body.innerHTML += - '
\ + } else { + axiosInstance({ + method: 'get', + url: `${config.backendurl}/oauth/authorize`, + headers: { 'Content-Type': 'application/json' }, + params: $params + }) + .then(result => { + const isAuthorized = result.data.isAuthorized; + if (isAuthorized == true) { + document.body.innerHTML += + '\ \ + $params.client_id + + '">\ \ + $params.redirect_uri + + '">\ \ + $params.response_type + + '">\ \ + $params.grant_type + + '">\ \ + $params.state + + '">\ \ + $params.scope + + '">\ \ + $params.nonce + + '">\
'; - let el = document.getElementById('dynForm'); - el.submit(); - } else - navigate(`/authorize?${finalParams}&clientName=${result.data.client.name}`, { - replace: true + let el = document.getElementById('dynForm'); + el.submit(); + } else + navigate( + `/authorize?${finalParams}&clientName=${result.data.client.name}`, + { + replace: true + } + ); + }) + .catch(error => { + toasts.add({ + title: 'Oops', + description: + error.response.data.message || + error.response.data.errors[1].msg || + 'Something went wrong, please try again!', + duration: 10000, // 0 or negative to avoid auto-remove + placement: 'bottom-right', + type: 'error', + showProgress: true, + theme: $theme.name }); - }) - .catch(error => { - toasts.add({ - title: 'Oops', - description: - error.response.data.message || - error.response.data.errors[1].msg || - 'Something went wrong, please try again!', - duration: 10000, // 0 or negative to avoid auto-remove - placement: 'bottom-right', - type: 'error', - showProgress: true, - theme: $theme.name + navigate(`/`, { replace: true }); }); - navigate(`/`, { replace: true }); - }); } } else { localStorage.setItem('Dauth_params', finalParams); diff --git a/src/routes/RegistrationDetails.svelte b/src/routes/RegistrationDetails.svelte index bcb0b70..7a5c3dc 100644 --- a/src/routes/RegistrationDetails.svelte +++ b/src/routes/RegistrationDetails.svelte @@ -98,18 +98,18 @@ return; } let phno = state.phone.toString(); - let number:any = phno.substring(1, phno.length); - if (phno[0] != '+' || isNaN(number)) { - toasts.add({ - title: 'Oops!', - description: 'Make sure to add country code and valid phone number', - duration: 10000, // 0 or negative to avoid auto-remove - placement: 'bottom-right', - type: 'error', - showProgress: true, - theme: $theme.name - }); - return; + let number: any = phno.substring(1, phno.length); + if (phno[0] != '+' || isNaN(number)) { + toasts.add({ + title: 'Oops!', + description: 'Make sure to add country code and valid phone number', + duration: 10000, // 0 or negative to avoid auto-remove + placement: 'bottom-right', + type: 'error', + showProgress: true, + theme: $theme.name + }); + return; } else { axiosInstance({ method: 'post', @@ -159,28 +159,28 @@ {#await getBatches()}
Loading..
{:then batches} -
- - -
-
-
Please enter the details to create an account!
-
-
-
-
- { - handleChange(e); - }} - />
-
- +
+
+
Please enter the details to create an account!
+
+
+
+
+ { + handleChange(e); + }} + />
+
+