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> = (() => {
// },
// ];
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) {
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 React from 'react';
import { getAvailablePaths } from 'lib/networks';
import ApiKeys from 'ui/pages/ApiKeys';
const ApiKeysPage: NextPage = () => {
......@@ -14,3 +15,13 @@ const ApiKeysPage: NextPage = () => {
};
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 React from 'react';
import { getAvailablePaths } from 'lib/networks';
import CustomAbi from 'ui/pages/CustomAbi';
const CustomAbiPage: NextPage = () => {
......@@ -14,3 +15,13 @@ const CustomAbiPage: NextPage = () => {
};
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 React from 'react';
import { getAvailablePaths } from 'lib/networks';
import PublicTags from 'ui/pages/PublicTags';
const PublicTagsPage: NextPage = () => {
......@@ -14,3 +15,13 @@ const PublicTagsPage: NextPage = () => {
};
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 React from 'react';
import { getAvailablePaths } from 'lib/networks';
import PrivateTags from 'ui/pages/PrivateTags';
const AddressTagsPage: NextPage = () => {
......@@ -14,3 +15,13 @@ const AddressTagsPage: NextPage = () => {
};
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 React from 'react';
import { getAvailablePaths } from 'lib/networks';
import PrivateTags from 'ui/pages/PrivateTags';
const TransactionTagsPage: NextPage = () => {
......@@ -14,3 +15,13 @@ const TransactionTagsPage: NextPage = () => {
};
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 React from 'react';
import { getAvailablePaths } from 'lib/networks';
import WatchList from 'ui/pages/Watchlist';
const WatchListPage: NextPage = () => {
......@@ -14,3 +15,13 @@ const WatchListPage: NextPage = () => {
};
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 React from 'react';
import { getAvailablePaths } from 'lib/networks';
import MyProfile from 'ui/pages/MyProfile';
const MyProfilePage: NextPage = () => {
......@@ -14,3 +15,13 @@ const MyProfilePage: NextPage = () => {
};
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 type { NextPage } from 'next';
import type { NextPage, GetStaticPaths } from 'next';
import { useRouter } from 'next/router';
import React from 'react';
import { getAvailablePaths } from 'lib/networks';
import Page from 'ui/shared/Page/Page';
const Home: NextPage = () => {
......@@ -22,3 +23,13 @@ const Home: NextPage = () => {
};
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