Closed cannalee90 closed 6 years ago
스토어를 리셋시키는 방법만으론 리다이렉트를 안한다.
private route도 작동을 안한다.
firebase가 새롭게 받아온다..? 로그아웃 된게 아닌가?
signInWithPopup()
으로 해결함.
<App />
렌더링userSignout
액션보다 먼저 url바뀌는 문제가 있었는데, firebase의 signout을 하면 일단 루트로 튕겨서 그런것 같..다
조금씩 이상하게 작동했던 이유가 토큰이 user.accessToken에 저장되어 있을 경우 userFetchInfo()를 디스패치 하도록(토큰이 있는 상태에서 '/' 로 url에 바로 접속하는 경우를 가정) comonentWillMount() 함수에서 코딩했는데, componentWillMount()가 내 생각대로 돌아가지 않아서 가끔 문제가 발생했었다.
해당 함수를 componentDidMount()에서 실행하니 제대로 동작함.
currentUser가 있고 현재 signIn한 상태가 아닐경우 강제로 파이어베이스에 로그아웃 리퀘스트를 날리도록 설정
https://stackoverflow.com/questions/35622588/how-to-reset-the-state-of-a-redux-store
리덕스 스토어 리셋하는 방법