[SOLVED] Moralis dashboard show undefined user detail

After successful login with metamask
Moralis dashboard showing undefined user details after login in with metamask , couldn’t fetch address,username and email

HTML CODE

<div class="card-body">

                                 

                <label for="user-username">Username</label>

                <div class="mb-3">

                  <input type="text" id="user-username" class="form-control" placeholder="Username" aria-label="Username" aria-describedby="Username-addon">

                </div>

                <label for="user-email">Email</label>

                <div class="mb-3">

                  <input type="email" id="user-email" class="form-control" placeholder="Email" aria-label="Email" aria-describedby="email-addon">

                </div>

             

                <div class="text-center">

                  <button type="submit"  id="btn-login" class="mt-4 mb-0 btn bg-gradient-info w-100">Sign in</button>

                </div>

               

            </div>

JAVASCRIPT CODE

login = async () => {

  user =  await Moralis.Web3.authenticate().then(async function (user) {

        console.log('logged in');

        user.set("name", document.getElementById('user-username').value);

        user.set("email", document.getElementById('user-email').value);

        await user.save();

        window.location.href = "dashboard.html";

    })

}

document.querySelector('#btn-login').onclick = login;

can you share your full code?
were there any error in your browser console?
if you login again with metamask nothing changes in the dashboard?

it was show before just dont knw what happened
i tried to work on the proj but now discovered no response after login

ok, you can delete what you have in your User table and in your _EthAddress table, update your Moralis server and try again

okay let me try that

Good Thanks working now thanks :hugs::hugs:

1 Like

and pls more thing how do i redirect a page to another and still fetch data into the page
for example after login and wanna redirect to dashboard and show user EthAddress and other attributes inside the dashboard
cus have tried that but nothing shows

you can try: window.location.href = "/dashboard.html";