useMoralis React import [SOLVED]

I put it on a repo here

I am not going to leave it on there for too long ,but if youre there now can someone look at why line 44 in FormComponent.tsx is not working no matter what I try ? thanks

1 Like

Hey @ericnickus

Change header in FormComponent to:

import { useMoralis } from "react-moralis";
import React from "react";

export default function FormComponent() {
  const { user, Moralis, isAuthenticated } = useMoralis();

THANK YOU . You guys are Golden Gods !

make sure you have imported it liek this:

import { useMoralis } from "react-moralis"

omg , now Iā€™m getting this error on The Authenticate component

import { Stack } from "@chakra-ui/layout";
import { Box, Button, HStack, Image } from "@chakra-ui/react";
import { useMoralis } from "react-moralis";
import { CheckIcon } from "@chakra-ui/icons";
import React from "react";

export default function Authentication() {
  
  const { user } = useMoralis();
  //const [username, setUsername] = React.useState<string>("");

  const {
    authenticate,
    authError,
    isAuthenticated,
    isAuthenticating,
    logout
  } = useMoralis();

  console.log( 
      user,
      isAuthenticated,
      isAuthenticating,
      authError);

  return (
    <div>
      <Stack spacing={6}>
          <Image src="bankXheader.jpg" alt="" />
        <div>
     
        <Image width="50%" src="giveaway7.png" alt="" />
        
          </div>

        
        <Box>
          {isAuthenticated ? (
            <>Authenticated with Metamask!<CheckIcon ml={2}  w={8} h={8} color="green.500"/>
            <Button onClick={() => logout()}>Logout</Button></>
          ) : (
            <HStack>
              <Button onClick={() => authenticate()}>Authenticate w Metamask</Button>
              <Button onClick={() => authenticate({ provider: "walletconnect" })}>Authenticate Walletconnect</Button>
            </HStack>
          )}
        </Box>    
      </Stack>
    </div>
  );
}

this the error : null false false Error: Account already exists for this email address.
Babel 2
_createSuper ParseError.js:42
ParseError ParseError.js:93
handleError RESTController.js:450

[on line 20]

why it giving an email error when im just authenticating metamask? ?

sorry to be such a nuisance but I want to go all in on your platform

It means your ethAddress was already linked to account with email address

You guys are incredible . Thanks.

2 Likes

So does it work correctly now?

Yeah it does, Iā€™m still testing it out but these problems have all been solved. I feel confident now about the app getting finished with a backend and everything, pressing forward with moralis. Than ks again

1 Like

You are welcome!

Happy BUIDLing :man_mechanic: