Skip to content

Commit

Permalink
add network error message
Browse files Browse the repository at this point in the history
  • Loading branch information
malerba118 committed Feb 16, 2022
1 parent 091cb9c commit 753ea09
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
import type { NextPage } from "next";
import * as React from "react";
import { QueryClient, QueryClientProvider } from "react-query";
import { QueryClient, QueryClientProvider, QueryCache } from "react-query";
import { ChakraProvider, Box, Heading } from "@chakra-ui/react";
import { Toaster } from "react-hot-toast";
import { Toaster, toast } from "react-hot-toast";
import theme from "../theme";

// Create a client
// Create a react-query client
const queryClient = new QueryClient({
defaultOptions: {
queries: {
refetchOnWindowFocus: false,
},
},
queryCache: new QueryCache({
onError: () => {
toast.error(
"Network Error: Ensure Metamask is connected to the same network that your contract is deployed to."
);
},
}),
});

const App: NextPage = () => {
Expand Down

0 comments on commit 753ea09

Please sign in to comment.