You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
638 B
30 lines
638 B
import {SampleJoke} from "../../model/SampleJoke";
|
|
|
|
export enum ActionType {
|
|
FETCH_JOKES = 'FETCH_JOKES',
|
|
FETCH_JOKES_BY_ID = 'FETCH_JOKES_BY_ID',
|
|
}
|
|
|
|
type actionFetch = {
|
|
type: ActionType.FETCH_JOKES;
|
|
payload: SampleJoke[];
|
|
}
|
|
type actionFetchById = {
|
|
type: ActionType.FETCH_JOKES_BY_ID;
|
|
payload: SampleJoke;
|
|
}
|
|
export type Action = actionFetch | actionFetchById;
|
|
|
|
export const setJokesList = (jokesList: SampleJoke[]) => {
|
|
return {
|
|
type: ActionType.FETCH_JOKES,
|
|
payload: jokesList,
|
|
};
|
|
}
|
|
|
|
export const setJokeById = (joke: SampleJoke) => {
|
|
return {
|
|
type: ActionType.FETCH_JOKES_BY_ID,
|
|
payload: joke,
|
|
};
|
|
} |