Skip to content

Instantly share code, notes, and snippets.

@Daltonic
Last active December 19, 2023 17:40
Show Gist options
  • Save Daltonic/55de269f6d41727ad2ca283adfea241e to your computer and use it in GitHub Desktop.
Save Daltonic/55de269f6d41727ad2ca283adfea241e to your computer and use it in GitHub Desktop.
Dapp Funds
import Banner from '@/components/Banner'
import Cards from '@/components/Cards'
import NavBtn from '@/components/NavBtn'
import { getMyCharities } from '@/services/blockchain'
import { globalActions } from '@/store/globalSlices'
import { CharityStruct, RootState } from '@/utils/type.dt'
import { NextPage } from 'next'
import Head from 'next/head'
import { useEffect } from 'react'
import { useDispatch, useSelector } from 'react-redux'
const Page: NextPage = () => {
const { charities } = useSelector((states: RootState) => states.globalStates)
const dispatch = useDispatch()
const { setCharities } = globalActions
useEffect(() => {
const fetchCharities = async () => {
const charitiesData: CharityStruct[] = await getMyCharities()
dispatch(setCharities(charitiesData))
}
fetchCharities()
}, [dispatch, setCharities])
return (
<div>
<Head>
<title>Charity Tracker</title>
<link rel="icon" href="/favicon.ico" />
</Head>
<Banner mine />
<div className="h-10"></div>
<Cards charities={charities} />
<div className="h-10"></div>
<NavBtn />
</div>
)
}
export default Page
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment