Commit 6a2ec0e0 authored by Igor Stuev's avatar Igor Stuev Committed by GitHub

Merge pull request #1048 from blockscout/no-rpc-no-add-network

hide add to wallet button if no rpc url
parents 38c25380 8078b937
import type { NextPage } from 'next'; import type { NextPage, GetServerSideProps } from 'next';
import dynamic from 'next/dynamic'; import dynamic from 'next/dynamic';
import Head from 'next/head'; import Head from 'next/head';
import React from 'react'; import React from 'react';
import appConfig from 'configs/app/config';
import type { Props } from 'lib/next/getServerSideProps';
import { getServerSideProps as getServerSidePropsBase } from 'lib/next/getServerSideProps';
import Page from 'ui/shared/Page/Page'; import Page from 'ui/shared/Page/Page';
const MarketplaceApp = dynamic(() => import('ui/pages/MarketplaceApp'), { ssr: false }); const MarketplaceApp = dynamic(() => import('ui/pages/MarketplaceApp'), { ssr: false });
...@@ -20,4 +23,12 @@ const MarketplaceAppPage: NextPage = () => { ...@@ -20,4 +23,12 @@ const MarketplaceAppPage: NextPage = () => {
export default MarketplaceAppPage; export default MarketplaceAppPage;
export { getServerSideProps } from 'lib/next/getServerSideProps'; export const getServerSideProps: GetServerSideProps<Props> = async(args) => {
if (!appConfig.marketplace.configUrl || !appConfig.network.rpcUrl) {
return {
notFound: true,
};
}
return getServerSidePropsBase(args);
};
import type { NextPage } from 'next'; import type { NextPage, GetServerSideProps } from 'next';
import dynamic from 'next/dynamic'; import dynamic from 'next/dynamic';
import Head from 'next/head'; import Head from 'next/head';
import React from 'react'; import React from 'react';
import appConfig from 'configs/app/config';
import type { Props } from 'lib/next/getServerSideProps';
import { getServerSideProps as getServerSidePropsBase } from 'lib/next/getServerSideProps';
import Page from 'ui/shared/Page/Page'; import Page from 'ui/shared/Page/Page';
import PageTitle from 'ui/shared/Page/PageTitle'; import PageTitle from 'ui/shared/Page/PageTitle';
...@@ -22,4 +25,12 @@ const MarketplacePage: NextPage = () => { ...@@ -22,4 +25,12 @@ const MarketplacePage: NextPage = () => {
export default MarketplacePage; export default MarketplacePage;
export { getServerSideProps } from 'lib/next/getServerSideProps'; export const getServerSideProps: GetServerSideProps<Props> = async(args) => {
if (!appConfig.marketplace.configUrl || !appConfig.network.rpcUrl) {
return {
notFound: true,
};
}
return getServerSidePropsBase(args);
};
...@@ -54,7 +54,7 @@ const NetworkAddToWallet = ({ className }: Props) => { ...@@ -54,7 +54,7 @@ const NetworkAddToWallet = ({ className }: Props) => {
} }
}, [ provider, toast ]); }, [ provider, toast ]);
if (!provider) { if (!provider || !appConfig.network.rpcUrl) {
return null; return null;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment