Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // change code below this line
- // I added:
- const LOGIN = "LOGIN";
- const LOGOUT = "LOGOUT";
- // change code above this line
- const defaultState = {
- authenticated: false
- };
- const authReducer = (state = defaultState, action) => {
- switch (action.type) {
- case 'LOGIN':
- return {
- authenticated: true
- }
- case 'LOGOUT':
- return {
- authenticated: false
- }
- default:
- return state;
- }
- };
- const store = Redux.createStore(authReducer);
- const loginUser = () => {
- return {
- type: 'LOGIN'
- }
- };
- const logoutUser = () => {
- return {
- type: 'LOGOUT'
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement