35 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
| 
 | |
| import { walletActionUrl } from "./IlinkConstants";
 | |
| import { fetchWalletListPending, fetchWalletListSuccess, fetchWalletListError } from "../redux/actions/WalletActions";
 | |
| import fetchQuery from "./FetchQuery";
 | |
| import { store } from "../redux/store";
 | |
| import axios from "axios";
 | |
| 
 | |
| const getWalletActivated = (userID) => {
 | |
| 
 | |
|      const auth = store.getState().authKeyReducer;
 | |
|      const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : '';
 | |
| 
 | |
|      console.log('AUTHKEY', authKey);
 | |
| 
 | |
|      return dispatch => {
 | |
|           dispatch(fetchWalletListPending());
 | |
| 
 | |
|           axios({
 | |
|                url: `${walletActionUrl}/${userID}/activated`,
 | |
|                method: 'GET',
 | |
|                headers: {
 | |
|                     'Authorization': authKey
 | |
|                }
 | |
|           })
 | |
|                .then(response => {
 | |
|                     console.log(response);
 | |
|                     dispatch(fetchWalletListSuccess(response));
 | |
|                })
 | |
|                .catch(error => {
 | |
|                     dispatch(fetchWalletListError(error.message));
 | |
|                });
 | |
|      }
 | |
| }
 | |
| 
 | |
| export default getWalletActivated; |