| 1 |
import { RecommendationsAction } from './constants'; |
| 2 |
import { Recommendation } from './models/Recommendation'; |
| 3 |
|
| 4 |
interface SetErrorPayload { |
| 5 |
error: string; |
| 6 |
} |
| 7 |
|
| 8 |
interface SetRecommendationsPayload { |
| 9 |
recommendations: Recommendation[]; |
| 10 |
} |
| 11 |
|
| 12 |
export const setError = ( { error }: SetErrorPayload ) => ( { |
| 13 |
type: RecommendationsAction.Error, |
| 14 |
error, |
| 15 |
} ); |
| 16 |
|
| 17 |
export const setRecommendations = ( { recommendations }: SetRecommendationsPayload ) => ( { |
| 18 |
type: RecommendationsAction.Recommendations, |
| 19 |
recommendations, |
| 20 |
} ); |
| 21 |
|
| 22 |
export const setLoaded = () => ( { |
| 23 |
type: RecommendationsAction.Loaded, |
| 24 |
} ); |
| 25 |
|