_app.js
import React from 'react'
import Head from 'next/head'
import Layout from '../components/layout'
import "bootstrap/dist/css/bootstrap.min.css";
import '../styles/global.css'
import '../styles/remixicon.css'
import { useEffect } from "react";
import { createClient, configureChains, defaultChains, WagmiConfig } from 'wagmi';
import { publicProvider } from 'wagmi/providers/public';
import { SessionProvider } from 'next-auth/react';
import { InjectedConnector } from 'wagmi/connectors/injected'
import { MoralisProvider } from "react-moralis";
const { chains, provider } = configureChains(defaultChains, [
publicProvider()
])
const client = createClient({
provider,
SessionProvider,
autoConnect: true,
connectors: [new InjectedConnector({ chains })]
});
function MyApp({ Component, pageProps }) {
useEffect(() => {
require("bootstrap/dist/js/bootstrap.bundle.min.js");
}, []);
return (
<WagmiConfig client={client}>
<SessionProvider session={pageProps.session} refetchInterval={0}>
<MoralisProvider appId="gRQ26K3vKSOUekuZzaJ2OcxC7VaGFpRyUdj4So7r" serverUrl="https://wnvkqhotzhox.usemoralis.com:2053/server" initializeOnMount={true}>
<Layout>
<Component {...pageProps} />
</Layout>
</MoralisProvider>,
</SessionProvider>
</WagmiConfig>
)
}
export default MyApp
component
import React from 'react'
import Image from 'next/image';
import Link from 'next/link';
import utilStyles from '../styles/utils.module.css';
import cn from 'classnames';
import {useCallback, useEffect, useState} from 'react';
import { utils, BigNumber, ContractTransaction } from 'ethers';
import { useNotification, Icon, Loading } from 'web3uikit';
import { getSession, signOut } from 'next-auth/react';
import _nftea from '../lib/contracts/NFTEAS.json'
import _labels from '../lib/contracts/LABELS.json'
import { useContractRead, useContractWrite, usePrepareContractWrite } from 'wagmi'
import { useMoralis,useMoralisFile } from "react-moralis";
import { Moralis } from 'moralis'
const HomePage = () => {
const { initialize, isInitialized } = useMoralis()
const {saveFile, moralisFile} = useMoralisFile()
console.log(isInitialized)
const handleUpload = async (event)=> {
console.log(event.target.files[0])
const toFile = event.target.files[0];
console.log(toFile)
if(toFile.type=='image/heic'){
}else{
if(toFile.type.startsWith('image')){
// setImage(toFile)
const _imageurl = await saveFile('testing', toFile, {saveIPFS: false})
console.log(_imageurl)
// const _saveimage = await saveFile(toFile.name, toFile, {saveIPFS: true})
// console.log('image saved ' + _saveimage);
// setImage(_saveimage)
}else{
// setMedia(toFile)
}
}
}
}
it is initailizing