Hi Mages!
Iām working (and learning) on the Zerion Clone, trying to add some featuresā¦ So here is a reminder of the structure:
!
So in App.js we have:
const APP_ID = process.env.REACT_APP_MORALIS_APPLICATION_ID;
const SERVER_URL = process.env.REACT_APP_MORALIS_SERVER_URL;
function App() {
return (
<MoralisProvider appId={APP_ID} serverUrl={SERVER_URL}>
<ThemeProvider theme={theme}>
<MainLayout />
</ThemeProvider>
</MoralisProvider>
);
}
We have the auth in Login.jsx
Iām working on Assets.jsx to display NFTs from matic so I added:
import { useMoralis } from "react-moralis";
export default function Assets() {
const { Moralis, user, isAuthenticated } = useMoralis();
async function getNFT(){
const options = {
chain: 'matic',
address: user.attributes.ethAddress
};
const polygonNFTs = await Moralis.Web3.getNFTs(options);
if (!isAuthenticated) {
console.log(polygonNFTs);
}
else {
console.log("not connected");
}
}
I didnāt get the the NFTs so I figured out itās because I wasnāt authenticated (having ānot connectedā in console).
Why is that? Did the authentication in Login.jsx, canāt I use that in all the project?