File tree Expand file tree Collapse file tree 3 files changed +3
-3
lines changed Expand file tree Collapse file tree 3 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import ReactGA from "react-ga";
1212function App ( ) {
1313 useEffect ( ( ) => {
1414 ReactGA . initialize ( "UA-173245995-1" ) ;
15+ setAuthToken ( )
1516 } ) ;
1617 return (
1718 < Provider store = { store } >
Original file line number Diff line number Diff line change @@ -9,8 +9,6 @@ if (process.env.NODE_ENV !== "development") {
99 console . log = ( ) => { } ;
1010}
1111
12- axios . defaults . withCredentials = true ;
13-
1412ReactDOM . render ( < App /> , document . getElementById ( "root" ) ) ;
1513
1614// If you want your app to work offline and load faster, you can change
Original file line number Diff line number Diff line change 11import axios from "axios" ;
22
33export const setAuthToken = ( token ) => {
4+ axios . defaults . withCredentials = true ;
45 if ( token ) {
56 // set AUTHORIZATION in headers of all request
67 axios . defaults . headers . common [ 'Authorization' ] = token || localStorage . getItem ( "jwtToken" ) ;
78 } else {
89 // delete from the headers
910 delete axios . defaults . headers . common [ 'Authorization' ] ;
1011 }
11- }
12+ }
You can’t perform that action at this time.
0 commit comments