1- import axios from " axios" ;
2- import toaster from " toasted-notes" ;
1+ import axios from ' axios' ;
2+ import toaster from ' toasted-notes' ;
33
4- import NotificationComponent from " ../../components/notification-component/NotificationComponent" ;
4+ import NotificationComponent from ' ../../components/notification-component/NotificationComponent' ;
55
6- const url = "https://urldev-mern-react-times-api.herokuapp.com" ;
7- // const url = `http://localhost:3000`;
6+ const url = process . env . REACT_APP_API_URL ;
87
9- export const GET_FAVORITE = " GET_FAVORITE" ;
10- export const ADD_FAVORITE = " ADD_FAVORITE" ;
11- export const DELETE_FAVORITE = " DELETE_FAVORITE" ;
12- export const FETCH_FAVORITE_ERROR = " FETCH_FAVORITE_ERROR" ;
13- export const CLEAN_FAVORITE_STATE = " CLEAN_FAVORITE_STATE" ;
8+ export const GET_FAVORITE = ' GET_FAVORITE' ;
9+ export const ADD_FAVORITE = ' ADD_FAVORITE' ;
10+ export const DELETE_FAVORITE = ' DELETE_FAVORITE' ;
11+ export const FETCH_FAVORITE_ERROR = ' FETCH_FAVORITE_ERROR' ;
12+ export const CLEAN_FAVORITE_STATE = ' CLEAN_FAVORITE_STATE' ;
1413
1514export const getFavorite = ( stock ) => ( {
1615 type : GET_FAVORITE ,
@@ -37,7 +36,7 @@ export const cleanFavoriteState = () => ({
3736} ) ;
3837
3938export const fetchGetFavorites = ( ) => async ( dispatch ) => {
40- const token = JSON . parse ( localStorage . getItem ( " token" ) ) ;
39+ const token = JSON . parse ( localStorage . getItem ( ' token' ) ) ;
4140
4241 const config = {
4342 headers : { Authorization : `Bearer ${ token } ` } ,
@@ -56,7 +55,7 @@ export const fetchAddFavorites = (stock) => async (dispatch) => {
5655 symbol : stock ,
5756 } ;
5857
59- const token = JSON . parse ( localStorage . getItem ( " token" ) ) ;
58+ const token = JSON . parse ( localStorage . getItem ( ' token' ) ) ;
6059
6160 const config = {
6261 headers : { Authorization : `Bearer ${ token } ` } ,
@@ -72,8 +71,8 @@ export const fetchAddFavorites = (stock) => async (dispatch) => {
7271 < NotificationComponent
7372 success = { true }
7473 text = { `You added ${ data . symbol [ 0 ] . name
75- . split ( "^" )
76- . join ( "" ) } to your favorites successfully.`}
74+ . split ( '^' )
75+ . join ( '' ) } to your favorites successfully.`}
7776 />
7877 ) ,
7978 { duration : 1500 }
@@ -96,7 +95,7 @@ export const fetchAddFavorites = (stock) => async (dispatch) => {
9695} ;
9796
9897export const fetchDeleteFavorite = ( id ) => async ( dispatch ) => {
99- const token = JSON . parse ( localStorage . getItem ( " token" ) ) ;
98+ const token = JSON . parse ( localStorage . getItem ( ' token' ) ) ;
10099
101100 const config = {
102101 headers : { Authorization : `Bearer ${ token } ` } ,
@@ -111,8 +110,8 @@ export const fetchDeleteFavorite = (id) => async (dispatch) => {
111110 < NotificationComponent
112111 success = { true }
113112 text = { `You deleted ${ data . symbol [ 0 ] . name
114- . split ( "^" )
115- . join ( "" ) } from your favorites.`}
113+ . split ( '^' )
114+ . join ( '' ) } from your favorites.`}
116115 />
117116 ) ,
118117 { duration : 1500 }
0 commit comments