Auth basico completado

This commit is contained in:
Daniel Cortes
2020-06-23 18:55:42 -04:00
parent 72107bbc91
commit f98ed25ed4
4 changed files with 113 additions and 52 deletions

View File

@@ -11,7 +11,13 @@ const reducer = (state, action) => {
...state,
user: action.user
}
default: return state;
case 'logout':
return {
...state,
user: action.user
}
default:
return state;
}
};
@@ -20,7 +26,7 @@ export const StateContext = createContext(null);
export const StateProvider = ({children}) => {
return (
<StateContext.Provider value={useReducer(reducer, initialState )}>
<StateContext.Provider value={useReducer(reducer, initialState)}>
{children}
</StateContext.Provider>
);