프론트 redux action에서 백엔드로 axios 요청도 안보내지고 dispatch(loginUserRequest)도 실행이 안되는거같음;
이거는 프론트 로그인 관련 리덕스 action.js
export const loginUser = ({ inputId, inputPassword }) => {
console.log('loginUser(actions) start')
return (dispatch) => {
dispatch(loginUserRequest)
console.log(inputId, inputPassword)
axios
.post('/api/user', {
params: {
userId: inputId,
userPassword: inputPassword,
},
})
.then((
이거는 백엔드에서 /routes/api/user.js
/api/user post처리하는 코드인데 반응이 없네 여기까진
router.post('/', (req, res) => {
console.log(req)
const { name, password } = req.body
이 코드는 백엔드 메인 server.js 라우팅해주는건데 혹시 몰라서 이것도 가져와봄
app.use('/api/user', userRoutes)
app.use('/api/auth', authRoutes)
app.use(express.static(path.join(__dirname, '../client/build')))
app.get('*', (req, res) => {
res.sendFile(path.join(__dirname, '../client/build/index.html'))
})
redux-thunk 받고 미들웨어 적용도 해놧는데 dispatch가 왜 안되지
dispatch(loginUserRequest()) 소괄호 쳐도 똑같네