'use client'; import StoreProvider from './store'; <% if (functionality.includes('antd')) { -%> import { ConfigProvider } from 'antd'; import enUS from 'antd/lib/locale/en_US'; <% } -%> <% if (lib.includes('aelf-web-login')) { -%> import WebLoginProvider from './webLoginProvider'; <% } -%> import { useEffect, useState } from 'react'; import { store } from 'redux/store'; import Loading from 'components/Loading'; import { setEthData } from 'redux/reducer/data'; import { fetchEtherscan } from 'api/request'; function Provider({ children }: { children: React.ReactNode }) { const [loading, setLoading] = useState(true); const storeConfig = async () => { const { result } = await fetchEtherscan(); store.dispatch(setEthData(result)); setLoading(false); }; useEffect(() => { storeConfig(); }, []); return ( <> <% if (functionality.includes('antd')) { -%> <% } -%> {loading ? ( ) : ( <% if (lib.includes('aelf-web-login')) { -%> {children} <% } else { -%> <>{children} <% } -%> )} <% if (functionality.includes('antd')) { -%> <% } -%> ); } export default Provider;