File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -34,19 +34,23 @@ export const useTwoFactorAuth = () => {
3434 const fetchQrCode = useCallback ( async ( ) : Promise < void > => {
3535 try {
3636 const { svg } = await fetchJson < TwoFactorSetupData > ( qrCode . url ( ) ) ;
37+
3738 setQrCodeSvg ( svg ) ;
3839 } catch ( error ) {
3940 console . error ( 'Failed to fetch QR code:' , error ) ;
41+
4042 setQrCodeSvg ( null ) ;
4143 }
4244 } , [ ] ) ;
4345
4446 const fetchSetupKey = useCallback ( async ( ) : Promise < void > => {
4547 try {
4648 const { secretKey : key } = await fetchJson < TwoFactorSecretKey > ( secretKey . url ( ) ) ;
49+
4750 setManualSetupKey ( key ) ;
4851 } catch ( error ) {
4952 console . error ( 'Failed to fetch setup key:' , error ) ;
53+
5054 setManualSetupKey ( null ) ;
5155 }
5256 } , [ ] ) ;
@@ -59,9 +63,11 @@ export const useTwoFactorAuth = () => {
5963 const fetchRecoveryCodes = useCallback ( async ( ) : Promise < void > => {
6064 try {
6165 const codes = await fetchJson < string [ ] > ( recoveryCodes . url ( ) ) ;
66+
6267 setRecoveryCodesList ( codes ) ;
6368 } catch ( error ) {
6469 console . error ( 'Failed to fetch recovery codes:' , error ) ;
70+
6571 setRecoveryCodesList ( [ ] ) ;
6672 }
6773 } , [ ] ) ;
@@ -71,6 +77,7 @@ export const useTwoFactorAuth = () => {
7177 await Promise . all ( [ fetchQrCode ( ) , fetchSetupKey ( ) ] ) ;
7278 } catch ( error ) {
7379 console . error ( 'Failed to fetch setup data:' , error ) ;
80+
7481 setQrCodeSvg ( null ) ;
7582 setManualSetupKey ( null ) ;
7683 }
You can’t perform that action at this time.
0 commit comments