From 26078469cfcb3a7e0201a5b261e26d624464ff2c Mon Sep 17 00:00:00 2001 From: cesarhenrq Date: Mon, 9 Oct 2023 07:41:02 -0300 Subject: [PATCH] feat: add type guard to set user --- src/contexts/user/dispatcher.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/contexts/user/dispatcher.ts b/src/contexts/user/dispatcher.ts index e57c738..4b359ec 100644 --- a/src/contexts/user/dispatcher.ts +++ b/src/contexts/user/dispatcher.ts @@ -10,6 +10,7 @@ export const userDispatcher = ( ): User | null => { switch (action.type) { case 'SET_USER': + if (!action.payload) return state; return { ...action.payload, };