@@ -42,12 +42,12 @@ export const LOGIN_WITH_2FA = gql`
42
42
mutation LoginWithTwoFactorAuthentication(
43
43
$email: String!
44
44
$otp: String!
45
- $TwoWayVerificationToken: String!
45
+ # $TwoWayVerificationToken: String!
46
46
) {
47
47
loginWithTwoFactorAuthentication(
48
48
email: $email
49
49
otp: $otp
50
- TwoWayVerificationToken: $TwoWayVerificationToken
50
+ # TwoWayVerificationToken: $TwoWayVerificationToken
51
51
) {
52
52
token
53
53
user {
@@ -84,7 +84,7 @@ const TwoFactorPage: React.FC = () => {
84
84
85
85
const location = useLocation ( ) ;
86
86
const navigate = useNavigate ( ) ;
87
- const { email, TwoWayVerificationToken } = location . state || { } ;
87
+ const { email } = location . state || { } ;
88
88
useEffect ( ( ) => {
89
89
// Update document class and localStorage when theme changes
90
90
if ( isDark ) {
@@ -97,30 +97,30 @@ const TwoFactorPage: React.FC = () => {
97
97
} , [ isDark ] ) ;
98
98
99
99
useEffect ( ( ) => {
100
- if ( ! email || ! TwoWayVerificationToken ) {
100
+ if ( ! email ) {
101
101
navigate ( '/login' ) ;
102
102
}
103
- } , [ email , TwoWayVerificationToken , navigate ] ) ;
103
+ } , [ email , navigate ] ) ;
104
104
105
105
const [ loginWithTwoFactorAuthentication ] = useMutation < LoginResponse > (
106
106
LOGIN_WITH_2FA ,
107
107
{
108
108
onCompleted : async ( data ) => {
109
109
const response = data . loginWithTwoFactorAuthentication ;
110
110
try {
111
- localStorage . setItem ( 'authToken' , response . token ) ;
111
+ // localStorage.setItem('authToken', response.token);
112
112
localStorage . setItem ( 'user' , JSON . stringify ( response . user ) ) ;
113
113
await login ( response ) ;
114
114
await client . resetStore ( ) ;
115
115
toast . success ( response . message ) ;
116
116
117
117
const rolePaths : Record < string , string > = {
118
- superAdmin : '/dashboard ' ,
118
+ superAdmin : '/organizations ' ,
119
119
admin : '/trainees' ,
120
120
coordinator : '/trainees' ,
121
121
manager : '/dashboard' ,
122
122
ttl : '/ttl-trainees' ,
123
- trainee : '/dashboard ' ,
123
+ trainee : '/performance ' ,
124
124
} ;
125
125
126
126
const redirectPath = rolePaths [ response . user . role ] || '/dashboard' ;
@@ -152,7 +152,7 @@ const TwoFactorPage: React.FC = () => {
152
152
variables : {
153
153
email,
154
154
otp : currentInput . join ( '' ) ,
155
- TwoWayVerificationToken,
155
+ // TwoWayVerificationToken,
156
156
} ,
157
157
} ) ;
158
158
} finally {
0 commit comments