codestates / codestates/AllForYou

[Error] 홍세환 / 2022-01-11

Open
#102 0 comments 0 reactions 0 assignees View on GitHub
Err
Dominant language
JavaScript
Stars
0
Forks
4
PR merge metrics
No merged PRs in 30d

Description

### 어떤 에러인가요?
* (Redux) 로그인 정보 상태 값 변동 없음
* 로그아웃 버튼 클릭시 403 (Forbidden) 접근 권한 없음 에러 발생

### 에러 메시지
$```Uncaught (in promise) Error: Request failed with status code 403```

### 에러 핸들링 방법
* 아래 Reducer 로그인 파일 작성 코드에서
```const loginReducer = (state = loginstate, action) => {
switch (action.type) {
case LOGIN:
return Object.assign({}, state, {
isLogin: action.payload.isLogin,
isAdmin: action.payload.isAdmin,
nickname: action.payload.nickname,
email: action.payload.email,
oauth: action.payload.oauth,
PROFILE_IMG: action.payload.profileimg
});
아래와 같이 isLogin을 따로 빼주는 코드로 변경
const loginReducer = (state = initialState, action) => {
switch (action.type) {
case LOGIN:
return Object.assign({}, state, {
isLogin: action.payload.isLogin,
});

case SET_USERINFO:
return Object.assign({}, state, {
userinfo: action.payload,
});

default:
return state;
}
};

403 에러는 계속해서 핸들링 예정

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.