@@ -12,12 +12,11 @@ import {
12
12
} from "./auth-action-types" ;
13
13
14
14
import { SOCKET_INIT } from "./chats-action-types" ;
15
- // DISABLE WITH withCredentials for development
16
15
17
16
export const loadUser = ( ) => async ( dispatch ) => {
18
17
try {
19
18
const res = await axios . get ( "/api/auth" , {
20
- // withCredentials: true,
19
+ withCredentials : true ,
21
20
} ) ;
22
21
dispatch ( {
23
22
type : SOCKET_INIT ,
@@ -43,7 +42,7 @@ export const signUp = (username, email, password) => async (dispatch) => {
43
42
headers : {
44
43
"Content-Type" : "application/json" ,
45
44
} ,
46
- // withCredentials: true,
45
+ withCredentials : true ,
47
46
} ;
48
47
49
48
const body = JSON . stringify ( { username, email, password } ) ;
@@ -87,7 +86,7 @@ export const signIn = (email, password) => async (dispatch) => {
87
86
headers : {
88
87
"Content-Type" : "application/json" ,
89
88
} ,
90
- // withCredentials: true,
89
+ withCredentials : true ,
91
90
} ;
92
91
93
92
const body = JSON . stringify ( { email, password } ) ;
@@ -126,7 +125,9 @@ export const removeErrors = () => (dispatch) => {
126
125
127
126
// Logout
128
127
export const logout = ( ) => async ( dispatch ) => {
129
- await axios . put ( "api/auth" ) ;
128
+ await axios . put ( "/api/auth" , {
129
+ withCredentials : true ,
130
+ } ) ;
130
131
dispatch ( {
131
132
type : LOGOUT ,
132
133
} ) ;
0 commit comments