feat: create ActionType context

This commit is contained in:
karishmas6
2024-09-24 12:08:19 +05:30
parent b2c1babcfc
commit 2131b5307f

View File

@@ -6,6 +6,11 @@ interface ProviderProps {
children: React.ReactNode;
}
interface ActionType {
type: 'LOGIN' | 'LOGOUT';
payload?: any;
}
type InitialStateType = {
user: any;
};
@@ -22,7 +27,7 @@ const Context = createContext<{
dispatch: () => null,
});
const reducer = (state: InitialStateType, action) => {
const reducer = (state: InitialStateType, action: ActionType) => {
switch (action.type) {
case 'LOGIN':
return {