@@ -2,7 +2,6 @@ import React, { useState } from 'react';
22import { Box , Paper , TextField , Button , Typography } from '@mui/material' ;
33import { login } from '../api/auth' ;
44import { API_BASE } from '../config/apiConfig' ;
5- import { walletLogin , getWalletPublicKey } from '../wallet/resvault' ;
65import { Link , useNavigate } from 'react-router-dom' ;
76import { formatErrorMessage , clientValidation } from '../utils/errorHandling' ;
87
@@ -20,22 +19,6 @@ export default function Login({ onAuthed }) {
2019
2120 console . log ( 'Login attempt:' , { username : u , password : p . length > 0 ? '***' : 'empty' } ) ;
2221
23- let walletPubKey = null ;
24- try {
25- console . log ( 'Attempting wallet login...' ) ;
26- // Set a timeout for wallet operations to prevent hanging
27- await Promise . race ( [
28- ( async ( ) => {
29- await walletLogin ( ) ;
30- walletPubKey = await getWalletPublicKey ( ) ;
31- console . log ( 'Wallet login successful:' , walletPubKey ) ;
32- } ) ( ) ,
33- new Promise ( ( _ , reject ) => setTimeout ( ( ) => reject ( new Error ( 'Wallet timeout' ) ) , 3000 ) )
34- ] ) ;
35- } catch ( err ) {
36- console . warn ( 'Wallet login failed or timed out (optional):' , err . message ) ;
37- }
38-
3922 // Client-side validation to provide immediate feedback
4023 const usernameTrim = ( u || '' ) . trim ( ) ;
4124 const usernameError = clientValidation . username ( usernameTrim ) ;
@@ -55,9 +38,9 @@ export default function Login({ onAuthed }) {
5538 try {
5639 console . log ( 'Attempting API login...' ) ;
5740 console . log ( 'Making fetch request to:' , `${ API_BASE } /auth/login` ) ;
58- console . log ( 'Request body:' , { username : usernameTrim , password : '***' , walletPubKey } ) ;
41+ console . log ( 'Request body:' , { username : usernameTrim , password : '***' } ) ;
5942
60- const res = await login ( usernameTrim , p , walletPubKey ) ;
43+ const res = await login ( usernameTrim , p , null ) ;
6144 console . log ( 'API login successful:' , res ) ;
6245 onAuthed ( { token : res . token , user : res . user } ) ;
6346 nav ( '/dashboard' ) ;
0 commit comments