diff --git a/src/components/Board.js b/src/components/Board.js index 9222fd88..4e8539ba 100644 --- a/src/components/Board.js +++ b/src/components/Board.js @@ -8,26 +8,61 @@ import NewCardForm from './NewCardForm'; import CARD_DATA from '../data/card-data.json'; class Board extends Component { + constructor() { super(); this.state = { + // card: CARD_DATA.cards, cards: [], }; } + componentDidMount() { + console.log("The component did in fact mount"); + + const GET_ALL_CARDS_URL = `${this.props.url}${this.props.boardName}/cards`; + + axios.get(GET_ALL_CARDS_URL) + .then((response) => { + this.setState({ + cards: response.data, + }); + }) + .catch((error) => { + this.setState({ + error: error.message + }); + }); +} + + + + + + render() { + const emoji = require("emoji-dictionary"); + + const cardList = this.state.cards.map(({card}) => { + console.log(card); + return + }); + console.log(cardList); + return (
- Board + {cardList}
) } - } Board.propTypes = { }; - export default Board; diff --git a/src/components/Card.js b/src/components/Card.js index 6788cc03..2e4426a3 100644 --- a/src/components/Card.js +++ b/src/components/Card.js @@ -5,10 +5,20 @@ import emoji from 'emoji-dictionary'; import './Card.css'; class Card extends Component { + constructor(props) { + super(props); + this.state = { + + } + } render() { return (
- Card +
) } diff --git a/src/data/card-data.json b/src/data/card-data.json index 1f9793ec..068e019d 100644 --- a/src/data/card-data.json +++ b/src/data/card-data.json @@ -6,7 +6,7 @@ }, { "text": "", - "Emoji": "heart_eyes" + "emoji": "heart_eyes" }, { "text": "REST is part of work"