This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Our action to fetch all places in actions/index.js | |
export function fetchPlaces() { | |
return dispatch => { | |
return axios.get('/api/places/fetchAll') | |
.then(resp => { | |
dispatch(updatePlaces(resp.data)); | |
}) | |
.catch(err => { | |
console.log('Couldn\'t fetch places: ', err); | |
dispatch(authError(err)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Fetch all places action to test in actions/index.js | |
import axios from 'axios'; | |
export function fetchPlaces() { | |
return dispatch => { | |
return axios.get('/api/places/fetchAll') | |
.then(resp => { | |
dispatch(updatePlaces(resp.data)); | |
}) | |
.catch(err => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Header component to test in header.js | |
import React, {Component} from 'react'; | |
import { Link } from 'react-router'; | |
export class Header extends Component { // Here we export our class | |
render() { | |
const { logoutUser } = this.props; | |
return ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Header component to test in header.js | |
import React, {Component} from 'react'; | |
import { Link } from 'react-router'; | |
export class Header extends Component { | |
render() { | |
const { logoutUser } = this.props; | |
return ( |