remove or commit un-used vars in settings page
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import React, { useState, useEffect } from "react";
|
import React, { useState, useEffect } from "react";
|
||||||
|
|
||||||
import { useNavigate, Link } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import {
|
import {
|
||||||
Grid,
|
Grid,
|
||||||
Typography,
|
Typography,
|
||||||
@@ -23,19 +23,16 @@ const Settings = (props) => {
|
|||||||
const [username, setUsername] = useState("");
|
const [username, setUsername] = useState("");
|
||||||
const [firstname, setFirstname] = useState("");
|
const [firstname, setFirstname] = useState("");
|
||||||
const [lastname, setLastname] = useState("");
|
const [lastname, setLastname] = useState("");
|
||||||
const [title, setTitle] = useState("");
|
|
||||||
const [companyname, setCompanyname] = useState("");
|
|
||||||
const [email, setEmail] = useState("");
|
const [email, setEmail] = useState("");
|
||||||
const [phone, setPhone] = useState("");
|
|
||||||
const [currentPassword, setCurrentPassword] = useState("");
|
const [currentPassword, setCurrentPassword] = useState("");
|
||||||
const [newPassword, setNewPassword] = useState("");
|
const [newPassword, setNewPassword] = useState("");
|
||||||
const [newPassword2, setNewPassword2] = useState("");
|
const [newPassword2, setNewPassword2] = useState("");
|
||||||
const [file, setFile] = React.useState("");
|
// const [file, setFile] = React.useState("");
|
||||||
const [fileBase64, setFileBase64] = React.useState(
|
// const [fileBase64, setFileBase64] = React.useState(
|
||||||
userdata.image === undefined || userdata.image === null
|
// userdata.image === undefined || userdata.image === null
|
||||||
? theme.palette.defaultImage
|
// ? theme.palette.defaultImage
|
||||||
: userdata.image
|
// : userdata.image
|
||||||
);
|
// );
|
||||||
const [loadedValidationWorkflows, setLoadedValidationWorkflows] =
|
const [loadedValidationWorkflows, setLoadedValidationWorkflows] =
|
||||||
React.useState([]);
|
React.useState([]);
|
||||||
const [selfOwnedWorkflows, setSelfOwnedWorkflows] = React.useState([]);
|
const [selfOwnedWorkflows, setSelfOwnedWorkflows] = React.useState([]);
|
||||||
@@ -43,7 +40,6 @@ const Settings = (props) => {
|
|||||||
React.useState([]);
|
React.useState([]);
|
||||||
|
|
||||||
// Used for error messages etc
|
// Used for error messages etc
|
||||||
const [formMessage] = useState("");
|
|
||||||
const [passwordFormMessage, setPasswordFormMessage] = useState("");
|
const [passwordFormMessage, setPasswordFormMessage] = useState("");
|
||||||
|
|
||||||
const [firstrequest, setFirstRequest] = useState(true);
|
const [firstrequest, setFirstRequest] = useState(true);
|
||||||
@@ -296,58 +292,58 @@ const Settings = (props) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const registerProviders = (userdata) => {
|
// const registerProviders = (userdata) => {
|
||||||
// Register hooks here
|
// // Register hooks here
|
||||||
detectEthereumProvider().then((provider) => {
|
// detectEthereumProvider().then((provider) => {
|
||||||
if (provider) {
|
// if (provider) {
|
||||||
if (!provider.isMetaMask) {
|
// if (!provider.isMetaMask) {
|
||||||
alert.error("Only MetaMask is supported as of now.");
|
// alert.error("Only MetaMask is supported as of now.");
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
// Find the ethereum network
|
// // Find the ethereum network
|
||||||
// Get the users' account(s)
|
// // Get the users' account(s)
|
||||||
//alert.info("Connecting to MetaMask")
|
// //alert.info("Connecting to MetaMask")
|
||||||
//console.log("Connected: ", provider.isConnected())
|
// //console.log("Connected: ", provider.isConnected())
|
||||||
|
|
||||||
if (!provider.isConnected()) {
|
// if (!provider.isConnected()) {
|
||||||
alert.error("Metamask is not connected.");
|
// alert.error("Metamask is not connected.");
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
provider.on("message", (event) => {
|
// provider.on("message", (event) => {
|
||||||
alert.info("Ethereum message: ", event);
|
// alert.info("Ethereum message: ", event);
|
||||||
});
|
// });
|
||||||
|
|
||||||
provider.on("chainChanged", (chainId) => {
|
// provider.on("chainChanged", (chainId) => {
|
||||||
console.log("Changed chain to: ", chainId);
|
// console.log("Changed chain to: ", chainId);
|
||||||
|
|
||||||
const method = "eth_getBalance";
|
// const method = "eth_getBalance";
|
||||||
const params = [userdata.eth_info.account, "latest"];
|
// const params = [userdata.eth_info.account, "latest"];
|
||||||
provider
|
// provider
|
||||||
.request({
|
// .request({
|
||||||
method: method,
|
// method: method,
|
||||||
params,
|
// params,
|
||||||
})
|
// })
|
||||||
.then((result) => {
|
// .then((result) => {
|
||||||
console.log("Got result: ", result);
|
// console.log("Got result: ", result);
|
||||||
if (result !== undefined && result !== null) {
|
// if (result !== undefined && result !== null) {
|
||||||
userdata.eth_info.balance = result;
|
// userdata.eth_info.balance = result;
|
||||||
userdata.eth_info.parsed_balance = result / 1000000000000000000;
|
// userdata.eth_info.parsed_balance = result / 1000000000000000000;
|
||||||
console.log("INFO: ", userdata);
|
// console.log("INFO: ", userdata);
|
||||||
setUserData(userdata);
|
// setUserData(userdata);
|
||||||
} else {
|
// } else {
|
||||||
alert.error("Couldn't find balance: ", result);
|
// alert.error("Couldn't find balance: ", result);
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
.catch((error) => {
|
// .catch((error) => {
|
||||||
// If the request fails, the Promise will reject with an error.
|
// // If the request fails, the Promise will reject with an error.
|
||||||
alert.error("Failed getting info from ethereum API: " + error);
|
// alert.error("Failed getting info from ethereum API: " + error);
|
||||||
});
|
// });
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
};
|
// };
|
||||||
|
|
||||||
// This should "always" have data
|
// This should "always" have data
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user