인프런 커뮤니티 질문&답변
답변 9
0
0
0
0
0
지니
질문자
// 게시물 로드하기
function loadMainPostsAPI(gpostId,title) { // http://localhost:3060/post/100/개발자
return axios.get(`/posts/${gpostId}/${title}`);
}
function* loadMainPosts() {
try {
const result = yield call(loadMainPostsAPI, action.data, action.data.gpostId, action.data.title);
yield put({
type: LOAD_MAIN_POSTS_SUCCESS,
data: result.data,
});
} catch (e) {
yield put({
type: LOAD_MAIN_POSTS_FAILURE,
error: e,
});
}
}
네 이렇게 수정해줬는데 여전히 불러오지 못하고있네요,, < post.js /routes >, < posts.js /routes > 에서
GpostId가 있는 게시물 불러오기, 게시물올리기 코드는 저렇게 하면 되는건가요??
0
0
지니
질문자
function* addPost(action) {
try {
const result = yield call(addPostAPI, action.data, action.data.gpostId, action.data.title);
yield put({
type: ADD_POST_SUCCESS,
data: result.data,
});
console.error(e);
} catch (e) {
yield put({
type: ADD_POST_FAILURE,
error: e,
});
}
}
답변감사합니다 이렇게 수정하란 말씀이신가요?
0
0
제로초(조현영)
지식공유자
function loadMainPostsAPI(gpos tId) { // http://localhost: 3060/post/100/개발자
return axios.get(`/posts/$ {gpostId}/${title}`);
}
function* loadMainPosts() {
try {
const result = yield cal l(loadMainPostsAPI);





