Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 234bc17

Browse files
committed
authState has been fixed.
1 parent 24b9acf commit 234bc17

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

‎day-15/bs-store/src/pages/login/Login.js‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ export default function Login() {
2121
authDispatch(logIn(values));
2222
authService.login(values).then((resp) => {
2323
if (resp !== 401) {
24-
25-
26-
console.log(resp);
24+
// console.log(resp);
2725
localStorage.setItem("userId", resp.userId);
2826
localStorage.setItem("firstName", resp.firstName);
2927
localStorage.setItem("lastName", resp.lastName);

‎day-15/bs-store/src/store/actions/authActions.js‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ export const LOGIN = "LOGIN";
44

55
const authService = new AuthService();
66

7-
export function logIn(body){
8-
return function(dispatch){
9-
authService.login(body)
10-
.then(resp => resp.data)
11-
.then(resp => dispatch({type: LOGIN, payload:resp}));
12-
}
13-
}
7+
export function logIn(body) {
8+
return function (dispatch) {
9+
authService
10+
.login(body)
11+
.then((resp) => resp)
12+
.then((resp) => dispatch({ type: LOGIN, payload: resp }));
13+
};
14+
}

‎day-15/bs-store/src/store/reducers/authReducer.js‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@ function authReducer(state={}, { type, payload }) {
99

1010
switch (type) {
1111
case LOGIN:
12+
console.log("reducer")
1213
return {
1314
...state,
14-
authItems:{
15-
payload
16-
},
15+
authItems:{
16+
...payload
17+
}
1718
};
1819

1920
default:

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /