Last active
October 12, 2020 19:07
-
-
Save YounglanHong/8d7eac99096ad11f8df6395ddaa4e138 to your computer and use it in GitHub Desktop.
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
import axios from "axios"; | |
export const SHOW_CARD = "SHOW_CARD"; | |
// 서버로부터 카드 데이터 가져오기 | |
export function getDeckCards() { | |
return dispatch => { | |
axios | |
.get("http://localhost:4000/card/cardInfo") | |
.then(res => { | |
dispatch(showCard(res.data)); | |
}) | |
.catch(error => { | |
console.log(error); | |
}); | |
}; | |
} | |
// 서버로부터 받은 카드 데이터를 reducer에서 SHOW_CARD 작업으로 처리 | |
export function showCard(cards) { | |
return { | |
type: SHOW_CARD, | |
cards: cards | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment