Skip to content

Commit

Permalink
Merge pull request #27 from ActoKids/erik_feature
Browse files Browse the repository at this point in the history
Erik feature In components/layout/SignedInLinks.js & SignedOutLinks I changed Log In and Log Out to Sign In and Sign Out
  • Loading branch information
coultergeist authored Mar 5, 2019
2 parents 86cc2e4 + 53fbb4e commit 516da7f
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/layout/SignedInLinks.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const SignedInLinks = () => {
return (
<ul className="right">
<li><NavLink to='/create'>Create Event</NavLink></li>
<li><NavLink to='/'>Log Out</NavLink></li>
<li><NavLink to='/'>Sign Out</NavLink></li>
<li><NavLink to='/' className="btn btn-floating pink lighten-1">EN</NavLink></li>
</ul>
)
Expand Down
2 changes: 1 addition & 1 deletion src/components/layout/SignedOutLinks.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const SignedOutLinks = () => {
return (
<ul className="right">
<li><NavLink to='/signup'>Sign Up</NavLink></li>
<li><NavLink to='/signin'>Log In</NavLink></li>
<li><NavLink to='/signin'>Sign In</NavLink></li>
</ul>
)
}
Expand Down
42 changes: 42 additions & 0 deletions src/store/actions/actions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import fetch from 'cross-fetch'

export const REQUEST_EVENT = 'REQUEST_EVENT'
export const RECEIVE_POST = 'RECEIVE_POST'
export const SELECT_POST = 'SELECT_POST'

export function requestEvent(event) {
return {
type: REQUEST_EVENT,
event
}
}

export function receiveEvent(event) {
return {
type: RECEIVE_EVENT,
event,
events: json.data.children.map(child => child.data),
receivedAt: Date.now()
}
}

export function selectEvent(event) {
return {
type: SELECT_EVENT,
event
}
}

function fetchEvents(event) {
return dispatch => {
dispatch(requestEvent(event))
return fetch('https://my.api.mockaroo.com/events.json?key=ab42ca00')
.then(response => response.json())
.then(json => dispatch(receiveEvent(event, json)))
}
}





37 changes: 37 additions & 0 deletions src/store/reducers/reducers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { combineReducers } from 'redux'
import {
SELECT_EVENT, REQUEST_EVENT, RECEIVE_EVENT
} from '../actions/actions'

function selectedEvent(state = 'reactjs', action) {
switch (action.type) {
case SELECT_EVENT:
return action.event
default:
return state
}
}

function events(
state = {
isFetching: false,
error: null,
events: []
},
action
) {
switch (action.type) {
case REQUEST_EVENT:
return Object.assign({}, state, {
isFetching: true,
})
case RECEIVE_EVENT:
return Object.assign({}, state, {
isFetching: false,
events: action.events
})
default:
return state

}
}

0 comments on commit 516da7f

Please sign in to comment.