** axios 로 회원가입 데이터를 보냈지만 ... cors에러로 해결 하지 못함 상용님이 원격으로 봐주신다고 합니다.
import axios from 'axios';
import { all, fork, put, call, takeLatest } from "redux-saga/effects";
import { SIGN_UP_REQUEST, SIGN_UP_SUCCESS, SIGN_UP_FAILURE } from '../reducers/user';
function signUpAPI(data) {
return axios.post('/signup', data);
}
function* signUp(action) {
try {
const result = yield call(signUpAPI, action.data);
console.log(result);
yield put({
type: SIGN_UP_SUCCESS,
});
} catch (err) {
console.log(err)
yield put({
type: SIGN_UP_FAILURE,
error: err.response.data,
});
}
}
function* watchSignUp() {
yield takeLatest(SIGN_UP_REQUEST, signUp);
}
export default function* userSaga() {
yield all([
fork(watchSignUp)
]);
}
프로젝트 화면 홈,
사이드 메뉴 만들기