2017-09-25 02:06:28 +00:00
|
|
|
import * as interfaces from './actionTypes';
|
|
|
|
import { TypeKeys } from './constants';
|
2017-11-17 21:12:27 +00:00
|
|
|
import { fetchRates, CCResponse } from './actionPayloads';
|
2017-09-25 02:06:28 +00:00
|
|
|
|
2017-09-26 03:41:11 +00:00
|
|
|
export type TFetchCCRates = typeof fetchCCRates;
|
2017-11-18 20:15:02 +00:00
|
|
|
export function fetchCCRates(symbols: string[] = []): interfaces.FetchCCRates {
|
2017-09-25 02:06:28 +00:00
|
|
|
return {
|
2017-09-26 03:41:11 +00:00
|
|
|
type: TypeKeys.RATES_FETCH_CC,
|
2017-11-18 20:15:02 +00:00
|
|
|
payload: fetchRates(symbols)
|
2017-09-25 02:06:28 +00:00
|
|
|
};
|
|
|
|
}
|
2017-11-17 21:12:27 +00:00
|
|
|
|
|
|
|
export type TFetchCCRatesSucceeded = typeof fetchCCRatesSucceeded;
|
2017-12-18 23:29:26 +00:00
|
|
|
export function fetchCCRatesSucceeded(payload: CCResponse): interfaces.FetchCCRatesSucceeded {
|
2017-11-17 21:12:27 +00: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
|
|
|
|
};
|
|
|
|
}
|