From 2131b5307fddff15fc796a93d43ea2d5874b8c11 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Tue, 24 Sep 2024 12:08:19 +0530 Subject: [PATCH] feat: create ActionType context --- src/context/auth.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/context/auth.tsx b/src/context/auth.tsx index 8b17886a..83c75b57 100644 --- a/src/context/auth.tsx +++ b/src/context/auth.tsx @@ -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 {