Skip to content

Commit

Permalink
feat: add type guard to set user
Browse files Browse the repository at this point in the history
  • Loading branch information
cesarhenrq committed Oct 9, 2023
1 parent 64ceaf2 commit 2607846
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/contexts/user/dispatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const userDispatcher = (
): User | null => {
switch (action.type) {
case 'SET_USER':
if (!action.payload) return state;
return {
...action.payload,
};
Expand Down

0 comments on commit 2607846

Please sign in to comment.