@@ -47,11 +47,16 @@ const DisablePasskeys: React.FC<DisablePasskeysProps> = ({
4747 }
4848
4949 const encodedEmail = encodeURIComponent ( email ) ;
50- const encodedToken = encodeURIComponent ( token ) ;
5150
5251 // Fetch user data
53- const userUrl = `${ apiOrigin } /admin/user?email=${ encodedEmail } &token=${ encodedToken } ` ;
54- const userResponse = await fetch ( userUrl ) ;
52+ const userUrl = `${ apiOrigin } /admin/user?email=${ encodedEmail } ` ;
53+ const userResponse = await fetch ( userUrl , {
54+ method : "GET" ,
55+ headers : {
56+ "Content-Type" : "application/json" ,
57+ "X-Auth-Token" : token ,
58+ } ,
59+ } ) ;
5560 if ( ! userResponse . ok ) {
5661 throw new Error ( "Failed to fetch user data" ) ;
5762 }
@@ -63,11 +68,14 @@ const DisablePasskeys: React.FC<DisablePasskeysProps> = ({
6368 }
6469
6570 // Disable passkeys action
66- const disablePasskeysUrl = `${ apiOrigin } /admin/user/disable-passkeys?token= ${ encodedToken } ` ;
71+ const disablePasskeysUrl = `${ apiOrigin } /admin/user/disable-passkeys` ;
6772 const body = JSON . stringify ( { userId } ) ;
6873 const disablePasskeysResponse = await fetch ( disablePasskeysUrl , {
6974 method : "POST" ,
70- headers : { "Content-Type" : "application/json" } ,
75+ headers : {
76+ "Content-Type" : "application/json" ,
77+ "X-Auth-Token" : token ,
78+ } ,
7179 body : body ,
7280 } ) ;
7381
@@ -80,7 +88,11 @@ const DisablePasskeys: React.FC<DisablePasskeysProps> = ({
8088 handleClose ( ) ; // Close dialog on successful action
8189 console . log ( "Passkeys disabled successfully" ) ;
8290 } catch ( error ) {
83- console . error ( "Error disabling passkeys:" , error ) ;
91+ if ( error instanceof Error ) {
92+ alert ( error . message ) ;
93+ } else {
94+ alert ( "Failed to disable passkeys" ) ;
95+ }
8496 } finally {
8597 setLoading ( false ) ;
8698 }
0 commit comments