File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,8 +8,25 @@ export default function ChangePassword(props) {
88 const [ newPassword , setNewPassword ] = useState ( "" ) ;
99 const [ confirmNewPassword , setConfirmNewPassword ] = useState ( "" ) ;
1010
11+ const handleChangePasswordClick = e => {
12+ e . preventDefault ( ) ;
13+
14+ fetch ( "https://api.bforborum.com/api/login" , {
15+ method : "PUT" ,
16+ headers : {
17+ "content-type" : "application/x-www-form-urlencoded" ,
18+ "authorization" : "Basic " + sessionStorage . getItem ( "apiKey" )
19+ } ,
20+ body : `password=${ newPassword } `
21+ } ) . then ( response => response . json ( ) ) . then ( response => {
22+ if ( ! response . ok ) {
23+ alert ( "An error occurred and the password could not be changed." ) ;
24+ }
25+ } )
26+ } ;
27+
1128 return (
12- < form className = { changePassword . form } >
29+ < form onSubmit = { handleChangePasswordClick } className = { changePassword . form } >
1330 < FormField
1431 labelContent = "Current Password"
1532 label = "currpass"
You can’t perform that action at this time.
0 commit comments