Skip to content

Commit 8120d3d

Browse files
committed
Add withCredential to axios config, fix path in logout action, remove unnecessary comment
1 parent cc2ad81 commit 8120d3d

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/actions/auth-actions.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,11 @@ import {
1212
} from "./auth-action-types";
1313

1414
import { SOCKET_INIT } from "./chats-action-types";
15-
// DISABLE WITH withCredentials for development
1615

1716
export const loadUser = () => async (dispatch) => {
1817
try {
1918
const res = await axios.get("/api/auth", {
20-
// withCredentials: true,
19+
withCredentials: true,
2120
});
2221
dispatch({
2322
type: SOCKET_INIT,
@@ -43,7 +42,7 @@ export const signUp = (username, email, password) => async (dispatch) => {
4342
headers: {
4443
"Content-Type": "application/json",
4544
},
46-
// withCredentials: true,
45+
withCredentials: true,
4746
};
4847

4948
const body = JSON.stringify({ username, email, password });
@@ -87,7 +86,7 @@ export const signIn = (email, password) => async (dispatch) => {
8786
headers: {
8887
"Content-Type": "application/json",
8988
},
90-
// withCredentials: true,
89+
withCredentials: true,
9190
};
9291

9392
const body = JSON.stringify({ email, password });
@@ -126,7 +125,9 @@ export const removeErrors = () => (dispatch) => {
126125

127126
// Logout
128127
export const logout = () => async (dispatch) => {
129-
await axios.put("api/auth");
128+
await axios.put("/api/auth", {
129+
withCredentials: true,
130+
});
130131
dispatch({
131132
type: LOGOUT,
132133
});

0 commit comments

Comments
 (0)