File tree Expand file tree Collapse file tree 2 files changed +14
-42
lines changed Expand file tree Collapse file tree 2 files changed +14
-42
lines changed Original file line number Diff line number Diff line change @@ -29,27 +29,13 @@ const SignIn = () => {
29
29
//store token in localstorage
30
30
localStorage . setItem ( 'LoginToken' , loginToken )
31
31
32
- if ( res . data . Msg === "Success" ) {
33
- if ( res . data . LoginUser [ 0 ] . is_active === 0 && res . data . LoginUser [ 0 ] . is_lock === 1 ) {
34
- alert ( 'Your Account has been locked. Unauthorized activity has been detected.' )
35
- localStorage . clear ( )
36
- navigate ( '/' )
37
- }
38
- else if ( res . data . LoginUser [ 0 ] . is_active === 0 ) {
39
- alert ( 'Your Account is still not Activate Wait for Activate from Admin' )
40
- localStorage . clear ( )
41
- navigate ( '/' )
42
- }
43
- else {
44
- //get and store login user role and email
45
- const userRole = res . data . LoginUser [ 0 ] . role ;
46
- const userEmail = res . data . LoginUser [ 0 ] . email ;
47
-
48
- //store data in localstore so that use secureLocalStorage
49
- secureLocalStorage . setItem ( "Login1" , userRole ) ;
50
- secureLocalStorage . setItem ( "login2" , userEmail ) ;
51
- navigate ( '/Dashboard' ) ;
52
- }
32
+ if ( res . data . Status === "Success" ) {
33
+ alert ( "Login Successfull" )
34
+ localStorage . setItem ( 'token' , res . data . Token )
35
+ navigate ( '/Dashboard' )
36
+ // login user Email
37
+ secureLocalStorage . setItem ( 'Login1' , res . data . Result . email )
38
+ secureLocalStorage . setItem ( 'Login2' , res . data . Result . Role )
53
39
}
54
40
else {
55
41
alert ( res . data . Error )
Original file line number Diff line number Diff line change @@ -26,27 +26,13 @@ const SignIn = () => {
26
26
//store token in localstorage
27
27
localStorage . setItem ( 'LoginToken' , loginToken )
28
28
29
- if ( res . data . Msg === "Success" ) {
30
- if ( res . data . LoginUser [ 0 ] . is_active === 0 && res . data . LoginUser [ 0 ] . is_lock === 1 ) {
31
- alert ( 'Your Account has been locked. Unauthorized activity has been detected.' )
32
- localStorage . clear ( )
33
- navigate ( '/' )
34
- }
35
- else if ( res . data . LoginUser [ 0 ] . is_active === 0 ) {
36
- alert ( 'Your Account is still not Activate Wait for Activate from Admin' )
37
- localStorage . clear ( )
38
- navigate ( '/' )
39
- }
40
- else {
41
- //get and store login user role and email
42
- const userRole = res . data . LoginUser [ 0 ] . role ;
43
- const userEmail = res . data . LoginUser [ 0 ] . email ;
44
-
45
- //store data in localstore so that use secureLocalStorage
46
- secureLocalStorage . setItem ( "Login1" , userRole ) ;
47
- secureLocalStorage . setItem ( "login2" , userEmail ) ;
48
- navigate ( '/Dashboard' ) ;
49
- }
29
+ if ( res . data . Status === "Success" ) {
30
+ alert ( "Login Successfull" )
31
+ localStorage . setItem ( 'token' , res . data . Token )
32
+ navigate ( '/Dashboard' )
33
+ // login user Email
34
+ secureLocalStorage . setItem ( 'Login1' , res . data . Result . email )
35
+ secureLocalStorage . setItem ( 'Login2' , res . data . Result . Role )
50
36
}
51
37
else {
52
38
alert ( res . data . Error )
You can’t perform that action at this time.
0 commit comments