Updates
This commit is contained in:
@@ -3,6 +3,7 @@ import type { AppProps } from "next/app";
|
||||
import { createContext } from "react";
|
||||
import { PagePropsType, TurboCIAdminAppContextType } from "../types";
|
||||
import useAppInit from "../hooks/use-app-init";
|
||||
import Toast from "@/twui/components/elements/Toast";
|
||||
|
||||
export const AppContext = createContext<TurboCIAdminAppContextType>(
|
||||
{} as TurboCIAdminAppContextType,
|
||||
@@ -11,9 +12,21 @@ export const AppContext = createContext<TurboCIAdminAppContextType>(
|
||||
export default function App({ Component, pageProps }: AppProps<PagePropsType>) {
|
||||
const init = useAppInit(pageProps);
|
||||
|
||||
const { toast, setToast } = init;
|
||||
|
||||
return (
|
||||
<AppContext.Provider value={{ ...init }}>
|
||||
<Component {...pageProps} />
|
||||
<Toast
|
||||
open={toast.toastOpen}
|
||||
closeDispatch={(open) => {
|
||||
setToast((prev) => ({ ...prev, toastOpen: false }));
|
||||
}}
|
||||
color={toast.toastStyle}
|
||||
closeDelay={toast.closeDelay}
|
||||
>
|
||||
{toast.toastMessage}
|
||||
</Toast>
|
||||
</AppContext.Provider>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user