import React, { useState } from "react"; import DialogTitle from "@material-ui/core/DialogTitle"; import Dialog from "@material-ui/core/Dialog"; import TextField from "@material-ui/core/TextField"; import Button from "@material-ui/core/Button"; import Divider from "@material-ui/core/Divider"; const SettingsDialog = (props) => { const { classes, onClose, settingsOpen, settingsData, globalUrl, isLoggedIn, setIsLoggedIn, ...other } = props; const [password1, setPassword1] = useState(""); const [password2, setPassword2] = useState(""); const [password3, setPassword3] = useState(""); const handleValidateForm = () => { var passlength = 10; if ( password1 === password2 && password1.length >= passlength && password3.length >= passlength ) { return true; } return false; }; const onChangePass1 = (e) => { setPassword1(e.target.value); }; const onChangePass2 = (e) => { setPassword2(e.target.value); }; const onChangePass3 = (e) => { setPassword3(e.target.value); }; const onSubmitPassReset = () => { console.log("Should change password"); // Rofl, this can't possibly be typesafe var data = '{"password1": "' + password1 + '", "password2": "' + password2 + '", "password3": "' + password3 + '"}'; fetch(globalUrl + "/passwordreset", { body: data, method: "POST", headers: { "Content-Type": "application/json", }, }) .then((response) => response.json()) .then((responseJson) => { console.log(responseJson); if (responseJson.status === true) { console.log("SUCCESS"); } }) .catch((error) => { console.log(error); }); }; //PaperProps={{style: {minWidth: "500px"}} return ( onClose()} {...other}> Settings

Username

{settingsData.username}

ApiKey

Change password

); }; export default SettingsDialog;