2017-09-24 19:06:28 -07:00
|
|
|
import * as interfaces from './actionTypes';
|
|
|
|
import { TypeKeys } from './constants';
|
2017-11-17 16:12:27 -05:00
|
|
|
import { fetchRates, CCResponse } from './actionPayloads';
|
2017-09-24 19:06:28 -07:00
|
|
|
|
2017-09-25 20:41:11 -07:00
|
|
|
export type TFetchCCRates = typeof fetchCCRates;
|
2017-11-18 13:15:02 -07:00
|
|
|
export function fetchCCRates(symbols: string[] = []): interfaces.FetchCCRates {
|
2017-09-24 19:06:28 -07:00
|
|
|
return {
|
2017-09-25 20:41:11 -07:00
|
|
|
type: TypeKeys.RATES_FETCH_CC,
|
2017-11-18 13:15:02 -07:00
|
|
|
payload: fetchRates(symbols)
|
2017-09-24 19:06:28 -07:00
|
|
|
};
|
|
|
|
}
|
2017-11-17 16:12:27 -05:00
|
|
|
|
|
|
|
export type TFetchCCRatesSucceeded = typeof fetchCCRatesSucceeded;
|
2017-12-18 18:29:26 -05:00
|
|
|
export function fetchCCRatesSucceeded(payload: CCResponse): interfaces.FetchCCRatesSucceeded {
|
2017-11-17 16:12:27 -05:00
|
|
|
return {
|
|
|
|
type: TypeKeys.RATES_FETCH_CC_SUCCEEDED,
|
|
|
|
payload
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export type TFetchCCRatesFailed = typeof fetchCCRatesFailed;
|
|
|
|
export function fetchCCRatesFailed(): interfaces.FetchCCRatesFailed {
|
|
|
|
return {
|
|
|
|
type: TypeKeys.RATES_FETCH_CC_FAILED
|
|
|
|
};
|
|
|
|
}
|