import React, { useState, useEffect } from "react"; import Paper from "@material-ui/core/Paper"; import Button from "@material-ui/core/Button"; import TextField from "@material-ui/core/TextField"; const bodyDivStyle = { margin: "auto", textAlign: "center", width: "768px", }; const boxStyle = { flex: "1", marginLeft: "10px", marginRight: "10px", paddingLeft: "30px", paddingRight: "30px", paddingBottom: "30px", paddingTop: "30px", backgroundColor: "#e8eaf6", display: "flex", flexDirection: "column", }; //const tmpdata = { // "username": "frikky", // "firstname": "fred", // "lastname": "ode", // "title": "topkek", // "companyname": "company here", // "email": "your email pls", // "phone": "PHONE!!", //} // FIXME - add fetch for data fields // FIXME - remove tmpdata // FIXME: Use isLoggedIn :) const Settings = (props) => { const { globalUrl, isLoaded } = props; const [newPassword, setNewPassword] = useState(""); const [newPassword2, setNewPassword2] = useState(""); const [passwordFormMessage, setPasswordFormMessage] = useState(""); const onPasswordChange = () => { const data = { newpassword: newPassword, newpassword2: newPassword2, reference: props.match.params.key, }; const url = globalUrl + "/api/v1/passwordreset"; fetch(url, { mode: "cors", method: "POST", body: JSON.stringify(data), credentials: "include", crossDomain: true, withCredentials: true, headers: { "Content-Type": "application/json; charset=utf-8", }, }) .then((response) => response.json().then((responseJson) => { if (responseJson["success"] === false) { setPasswordFormMessage(responseJson["reason"]); } }) ) .catch((error) => { setPasswordFormMessage("Something went wrong."); }); }; // This should "always" have data useEffect(() => {}); // Random names for type & autoComplete. Didn't research :^) const landingpageData = (