inflearn logo
강의

Course

Instructor

[Renewal] Creating a NodeBird SNS with React

로그인 관련 문제

219

ktw23786330

25 asked

0

안녕하세요 제로초 선생님. 분명 사이트에 얼마 전까지 로그인 하는데에서 문제가 발생한 적은 없었는데 무슨 코드를 잘못 건든건지 갑자기 로그인에 있어서 문제가 발생하고 있습니다.

위와 같이 LOG_IN_REQUEST와 LOG_IN_SUCCESS는 정상적으로 출력되는데, 로그인이 되지 않은 화면이 출력됩니다.

처음 로그인을 시도할 때는 첫 번째 사진이, 로그인이 되지 않아 다시 로그인을 시도할 경우 2번째 사진과 같은 network 창이 출력됩니다. 정확히 기억은 안나지만 Preflight는 CORS와 관련됐던걸로 기억하는데 서버 쪽에서 무언가 차단하고 있는 것일까요?

Next.js redux nodejs react express

Answer 1

0

ktw23786330

import { createWrapper } from 'next-redux-wrapper'
import { applyMiddlewarecomposecreateStore } from 'redux';
import { composeWithDevTools } from 'redux-devtools-extension';
import createSagaMiddleware from 'redux-saga';

import reducer from '../reducers';
import rootSaga from '../sagas/index';

const loggerMiddleware = ({ dispatchgetState }) => (next=> (action=> {
    console.log(action);
};

const configureStore = () => {
    const sagaMiddleware = createSagaMiddleware();
    const enhancer = process.env.NODE_ENV === 'production'
    ? compose(applyMiddleware(sagaMiddleware))
    : composeWithDevTools(applyMiddleware(sagaMiddlewareloggerMiddleware));
    // 배포용일 때는 devTools를 연결하지 않고 개발용일 때만 devTools를 연결
    const store = createStore(reducerenhancer);
    store.sagaTask = sagaMiddleware.run(rootSaga);
    return store;
};

const wrapper = createWrapper(configureStore, {
    debug: process.env.NODE_ENV === 'development',
    // 이후에 배포할 때 production으로 바꿔주기
});

export default wrapper;

import { createWrapper } from 'next-redux-wrapper';
import { applyMiddlewarecreateStorecompose } from 'redux';
import { composeWithDevTools } from 'redux-devtools-extension';
import createSagaMiddleware from 'redux-saga';

import reducer from '../reducers';
import rootSaga from '../sagas';

const loggerMiddleware = ({ dispatchgetState }) => (next=> (action=> {
  console.log(action);
  return next(action);
};

const configureStore = () => {
  const sagaMiddleware = createSagaMiddleware();
  const middlewares = [sagaMiddlewareloggerMiddleware];
  const enhancer = process.env.NODE_ENV === 'production'
    ? compose(applyMiddleware(...middlewares))
    : composeWithDevTools(applyMiddleware(...middlewares));
  const store = createStore(reducerenhancer);
  store.sagaTask = sagaMiddleware.run(rootSaga);
  return store;
};

const wrapper = createWrapper(configureStore, {
  debug: process.env.NODE_ENV === 'development',
});

export default wrapper;

위와 같았던 store/configureStore.js를 아래의 제로초 선생님 코드를 복사하고 나니 로그인 문제가 해결됐습니다. 음 무엇이 문제였을까요

0

zerocho

loggerMiddleware에서 next 빠뜨리셨네요

0

ktw23786330

아 그렇군요...! 감사합니다!

넥스트 버젼 질문

0

78

2

로그인시 401 Unauthorized 오류가 뜹니다

0

89

1

무한 스크롤 중 스크롤 튐 현상

0

175

1

특정 페이지 접근을 막고 싶을 때

0

103

2

createGlobalStyle의 위치와 영향범위

0

96

2

인라인 스타일 리렌더링 관련

0

91

2

vsc 에서 npm init 설치시 오류

0

146

2

nextjs 15버전 사용 가능할까요?

0

158

1

화면 새로고침 문의

0

121

1

RTK에서 draft, state 차이가 있나요?

0

153

2

Next 14 사용해도 될까요?

0

452

1

next, node 버전 / 폴더 구조 질문 드립니다.

0

349

1

url 오류 질문있습니다

0

211

1

ssh xxxxx로 우분투에 들어가려니까 port 22: Connection timed out

0

373

1

sudo certbot --nginx 에러

0

1275

2

Minified React error 콘솔에러 (hydrate)

0

470

1

카카오 공유했을 때 이전에 작성했던 글이 나오는 버그

0

247

1

프론트서버 배포 후 EADDRINUSE에러 발생

0

327

1

npm run build 에러

0

518

1

front 서버 npm run build 중에 발생한 에러들

0

382

1

서버 실행하고 브라우저로 들어갔을때 404에러

0

338

2

css 서버사이드 랜더링이 적용되지 않아서 문의 드립니다.

0

288

1

팔로워 3명씩 불러오고 데이터 합쳐주는걸로 바꾸고 서버요청을 무한으로하고있습니다.

0

239

2

해시태그 검색에서 throttle에 관해 질문있습니다.

0

201

1