Skip to content

Commit

Permalink
fix: Fixed build
Browse files Browse the repository at this point in the history
  • Loading branch information
banhaclong20 committed Jan 8, 2023
1 parent 864fd45 commit 7bf8456
Show file tree
Hide file tree
Showing 2 changed files with 1,002 additions and 944 deletions.
14 changes: 9 additions & 5 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import type { AppProps } from "next/app";
import Head from "next/head";
import { useRouter } from "next/router";
import { Provider } from "react-redux";

import { wrapper } from "../store/store";
import { Chakra } from "lib/components/Chakra";
Expand All @@ -11,6 +12,7 @@ import "lib/styles/globals.css";

const MyApp = ({ Component, pageProps }: AppProps) => {
const { pathname } = useRouter();
const { store, props } = wrapper.useWrappedStore(pageProps);

return (
<Chakra>
Expand All @@ -23,14 +25,16 @@ const MyApp = ({ Component, pageProps }: AppProps) => {
</Head>

{pathname.includes("admin") ? (
<Component {...pageProps} />
<Component {...props} />
) : (
<Layout>
<Component {...pageProps} />
</Layout>
<Provider store={store}>
<Layout>
<Component {...props} />
</Layout>
</Provider>
)}
</Chakra>
);
};

export default wrapper.withRedux(MyApp);
export default MyApp;
Loading

0 comments on commit 7bf8456

Please sign in to comment.