Commit f1aa43bb authored by tom's avatar tom Committed by isstuev

add 404 error for unknown networks

parent beec5c82
...@@ -106,8 +106,12 @@ export const NETWORKS: Array<Network> = (() => { ...@@ -106,8 +106,12 @@ export const NETWORKS: Array<Network> = (() => {
// }, // },
// ]; // ];
export const ACCOUNT_ROUTES = [ '/watchlist', '/private-tags', '/public-tags', '/api-keys', '/custom-abi' ]; export const ACCOUNT_ROUTES = [ '/watchlist', '/tag_address', '/tag_transaction', '/public_tags_request', '/api_key', '/custom_abi' ];
export function isAccountRoute(route: string) { export function isAccountRoute(route: string) {
return ACCOUNT_ROUTES.includes(route); return ACCOUNT_ROUTES.includes(route);
} }
export function getAvailablePaths() {
return NETWORKS.map(({ type, subType }) => ({ params: { network_type: type, network_sub_type: subType } }));
}
import type { NextPage } from 'next'; import type { NextPage, GetStaticPaths } from 'next';
import Head from 'next/head'; import Head from 'next/head';
import React from 'react'; import React from 'react';
import { getAvailablePaths } from 'lib/networks';
import ApiKeys from 'ui/pages/ApiKeys'; import ApiKeys from 'ui/pages/ApiKeys';
const ApiKeysPage: NextPage = () => { const ApiKeysPage: NextPage = () => {
...@@ -14,3 +15,13 @@ const ApiKeysPage: NextPage = () => { ...@@ -14,3 +15,13 @@ const ApiKeysPage: NextPage = () => {
}; };
export default ApiKeysPage; export default ApiKeysPage;
export const getStaticPaths: GetStaticPaths = async() => {
return { paths: getAvailablePaths(), fallback: false };
};
export const getStaticProps = async() => {
return {
props: {},
};
};
import type { NextPage } from 'next'; import type { NextPage, GetStaticPaths } from 'next';
import Head from 'next/head'; import Head from 'next/head';
import React from 'react'; import React from 'react';
import { getAvailablePaths } from 'lib/networks';
import CustomAbi from 'ui/pages/CustomAbi'; import CustomAbi from 'ui/pages/CustomAbi';
const CustomAbiPage: NextPage = () => { const CustomAbiPage: NextPage = () => {
...@@ -14,3 +15,13 @@ const CustomAbiPage: NextPage = () => { ...@@ -14,3 +15,13 @@ const CustomAbiPage: NextPage = () => {
}; };
export default CustomAbiPage; export default CustomAbiPage;
export const getStaticPaths: GetStaticPaths = async() => {
return { paths: getAvailablePaths(), fallback: false };
};
export const getStaticProps = async() => {
return {
props: {},
};
};
import type { NextPage } from 'next'; import type { NextPage, GetStaticPaths } from 'next';
import Head from 'next/head'; import Head from 'next/head';
import React from 'react'; import React from 'react';
import { getAvailablePaths } from 'lib/networks';
import PublicTags from 'ui/pages/PublicTags'; import PublicTags from 'ui/pages/PublicTags';
const PublicTagsPage: NextPage = () => { const PublicTagsPage: NextPage = () => {
...@@ -14,3 +15,13 @@ const PublicTagsPage: NextPage = () => { ...@@ -14,3 +15,13 @@ const PublicTagsPage: NextPage = () => {
}; };
export default PublicTagsPage; export default PublicTagsPage;
export const getStaticPaths: GetStaticPaths = async() => {
return { paths: getAvailablePaths(), fallback: false };
};
export const getStaticProps = async() => {
return {
props: {},
};
};
import type { NextPage } from 'next'; import type { NextPage, GetStaticPaths } from 'next';
import Head from 'next/head'; import Head from 'next/head';
import React from 'react'; import React from 'react';
import { getAvailablePaths } from 'lib/networks';
import PrivateTags from 'ui/pages/PrivateTags'; import PrivateTags from 'ui/pages/PrivateTags';
const AddressTagsPage: NextPage = () => { const AddressTagsPage: NextPage = () => {
...@@ -14,3 +15,13 @@ const AddressTagsPage: NextPage = () => { ...@@ -14,3 +15,13 @@ const AddressTagsPage: NextPage = () => {
}; };
export default AddressTagsPage; export default AddressTagsPage;
export const getStaticPaths: GetStaticPaths = async() => {
return { paths: getAvailablePaths(), fallback: false };
};
export const getStaticProps = async() => {
return {
props: {},
};
};
import type { NextPage } from 'next'; import type { NextPage, GetStaticPaths } from 'next';
import Head from 'next/head'; import Head from 'next/head';
import React from 'react'; import React from 'react';
import { getAvailablePaths } from 'lib/networks';
import PrivateTags from 'ui/pages/PrivateTags'; import PrivateTags from 'ui/pages/PrivateTags';
const TransactionTagsPage: NextPage = () => { const TransactionTagsPage: NextPage = () => {
...@@ -14,3 +15,13 @@ const TransactionTagsPage: NextPage = () => { ...@@ -14,3 +15,13 @@ const TransactionTagsPage: NextPage = () => {
}; };
export default TransactionTagsPage; export default TransactionTagsPage;
export const getStaticPaths: GetStaticPaths = async() => {
return { paths: getAvailablePaths(), fallback: false };
};
export const getStaticProps = async() => {
return {
props: {},
};
};
import type { NextPage } from 'next'; import type { NextPage, GetStaticPaths } from 'next';
import Head from 'next/head'; import Head from 'next/head';
import React from 'react'; import React from 'react';
import { getAvailablePaths } from 'lib/networks';
import WatchList from 'ui/pages/Watchlist'; import WatchList from 'ui/pages/Watchlist';
const WatchListPage: NextPage = () => { const WatchListPage: NextPage = () => {
...@@ -14,3 +15,13 @@ const WatchListPage: NextPage = () => { ...@@ -14,3 +15,13 @@ const WatchListPage: NextPage = () => {
}; };
export default WatchListPage; export default WatchListPage;
export const getStaticPaths: GetStaticPaths = async() => {
return { paths: getAvailablePaths(), fallback: false };
};
export const getStaticProps = async() => {
return {
props: {},
};
};
import type { NextPage } from 'next'; import type { NextPage, GetStaticPaths } from 'next';
import Head from 'next/head'; import Head from 'next/head';
import React from 'react'; import React from 'react';
import { getAvailablePaths } from 'lib/networks';
import MyProfile from 'ui/pages/MyProfile'; import MyProfile from 'ui/pages/MyProfile';
const MyProfilePage: NextPage = () => { const MyProfilePage: NextPage = () => {
...@@ -14,3 +15,13 @@ const MyProfilePage: NextPage = () => { ...@@ -14,3 +15,13 @@ const MyProfilePage: NextPage = () => {
}; };
export default MyProfilePage; export default MyProfilePage;
export const getStaticPaths: GetStaticPaths = async() => {
return { paths: getAvailablePaths(), fallback: false };
};
export const getStaticProps = async() => {
return {
props: {},
};
};
import { Center, VStack, Box } from '@chakra-ui/react'; import { Center, VStack, Box } from '@chakra-ui/react';
import type { NextPage } from 'next'; import type { NextPage, GetStaticPaths } from 'next';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import React from 'react'; import React from 'react';
import { getAvailablePaths } from 'lib/networks';
import Page from 'ui/shared/Page/Page'; import Page from 'ui/shared/Page/Page';
const Home: NextPage = () => { const Home: NextPage = () => {
...@@ -22,3 +23,13 @@ const Home: NextPage = () => { ...@@ -22,3 +23,13 @@ const Home: NextPage = () => {
}; };
export default Home; export default Home;
export const getStaticPaths: GetStaticPaths = async() => {
return { paths: getAvailablePaths(), fallback: false };
};
export const getStaticProps = async() => {
return {
props: {},
};
};
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