import React from "react" ; import { IQuestionData } from "../../Backend/model/Question-model" ; import { Error , Sucess } from "../../components/Alert" ; import { useHook } from "./hooks" ; const AuthContext = React . createContext < { authState : any ; loginWithRedirect ? : ( payload : { username : string ; password : string ; } ) => Promise < void > ; signupWithRedirect ? ( payload ) : Promise < void > ; accountReset ? ( payload ) : Promise < void > ; } > ( { authState : { } } ) ; export const useAuth = ( ) => React . useContext ( AuthContext ) ; interface AuthProviderProps { children : any ; } export const AuthProvider = ( { children , } ) => { const { authState , dispatch , dismiss , loginWithRedirect , signupWithRedirect , accountReset , } = useHook ( ) ; return ( < AuthContext . Provider value = { { authState , loginWithRedirect , signupWithRedirect , accountReset } } > < Error error = { authState . error } /> < Sucess message = { authState . message } / > { children } < /AuthContext.Provider>); } ;