Like @cryptokid recommended, im opening this new thread.
was following Chris Bs tutorial on how to create a dashboard.
getting the following error code after pressing the “transactions” button.
JS Code:
Moralis.initialize("HlFF10yjAlTVOgVKqbGQNsudjMOmlVoe4KOPtUlZ");
Moralis.serverURL = "https://yhitnni921dz.bigmoralis.com:2053/server";
// Got to re code the homepage once off the local host
let homepage = "http://127.0.0.1:5500/index.html";
if(Moralis.User.current() == null && window.location.href != homepage) {
document.querySelector("body").style.display = "none";
window.location.href = "index.html";
}
login = async() => {
await Moralis.authenticate().then( async function (user) {
console.log("logged in");
console.log(Moralis.User.current());
user.set("name", document.getElementById("userUsername").value);
user.set("email", document.getElementById("userEmail").value);
await user.save();
console.log("user info has been saved");
window.location.href = "dashboard.html";
})
}
logout = async() => {
await Moralis.User.logOut();
console.log("user logged out");
window.location.href = "index.html";
}
getTransactions = async () => {
console.log("getTxs");
const options = { chain: "bsc", address: "not displaying my address here."};
const transactions = await Moralis.Web3API.account.getTransactions(options);
console.log(transactions);
if(transactions.total > 0){
let tableTx = `
<table class="table">
<thead>
<tr>
<th scope = "col">Transaction</th>
<th scope = "col">Block Number</th>
<th scope = "col">Age</th>
<th scope = "col">Type</th>
<th scope = "col">Fee</th>
<th scope = "col">Value</th>
</tr>
</thead>
</tbody id="theTransactions">
</tbody>
</table>
`
document.querySelector("#tableOfTransactions").innerHTML = tableTx;
}
}
if(document.getElementById("btn-login") != null){
document.getElementById("btn-login").onclick = login;
}
if(document.getElementById("btn-logout") != null){
document.getElementById("btn-logout").onclick = logout;
}
if(document.getElementById("get-transactions-link") != null){
document.getElementById("get-transactions-link").onclick = getTransactions;
}
necessary HTML Code
<h2>Transactions</h2>
<div id = "tableOfTransactions "class="table-responsive">
</div>
Let me know. thank you!!