2023-01-17 18:04:42 +00:00
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
|
|
|
import { TYPES } from './action-types';
|
2023-01-31 16:52:35 +00:00
|
|
|
import { ApiFetchError, RegisteredChannel, RecommendedChannel } from './types';
|
2023-01-17 18:04:42 +00:00
|
|
|
|
2023-01-31 16:52:35 +00:00
|
|
|
export const receiveRegisteredChannelsSuccess = (
|
|
|
|
channels: Array< RegisteredChannel >
|
|
|
|
) => {
|
2023-01-17 18:04:42 +00:00
|
|
|
return {
|
2023-01-31 16:52:35 +00:00
|
|
|
type: TYPES.RECEIVE_REGISTERED_CHANNELS_SUCCESS,
|
2023-01-17 18:04:42 +00:00
|
|
|
payload: channels,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-01-31 16:52:35 +00:00
|
|
|
export const receiveRegisteredChannelsError = ( error: ApiFetchError ) => {
|
2023-01-17 18:04:42 +00:00
|
|
|
return {
|
2023-01-31 16:52:35 +00:00
|
|
|
type: TYPES.RECEIVE_REGISTERED_CHANNELS_ERROR,
|
2023-01-17 18:04:42 +00:00
|
|
|
payload: error,
|
|
|
|
error: true,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-01-19 11:33:51 +00:00
|
|
|
export const receiveRecommendedChannelsSuccess = (
|
2023-01-20 18:14:36 +00:00
|
|
|
channels: Array< RecommendedChannel >
|
2023-01-19 11:33:51 +00:00
|
|
|
) => {
|
|
|
|
return {
|
|
|
|
type: TYPES.RECEIVE_RECOMMENDED_CHANNELS_SUCCESS,
|
|
|
|
payload: channels,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
export const receiveRecommendedChannelsError = ( error: ApiFetchError ) => {
|
|
|
|
return {
|
|
|
|
type: TYPES.RECEIVE_RECOMMENDED_CHANNELS_ERROR,
|
|
|
|
payload: error,
|
|
|
|
error: true,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-01-17 18:04:42 +00:00
|
|
|
export type Action = ReturnType<
|
2023-01-31 16:52:35 +00:00
|
|
|
| typeof receiveRegisteredChannelsSuccess
|
|
|
|
| typeof receiveRegisteredChannelsError
|
2023-01-19 11:33:51 +00:00
|
|
|
| typeof receiveRecommendedChannelsSuccess
|
|
|
|
| typeof receiveRecommendedChannelsError
|
2023-01-17 18:04:42 +00:00
|
|
|
>;
|