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.
32 lines
740 B
32 lines
740 B
import {SampleJoke} from "../../model/SampleJoke";
|
|
import {Action, SampleActionType} from "../actions/sampleAction";
|
|
|
|
|
|
interface state {
|
|
sampleJoke: SampleJoke[];
|
|
recentJokes: SampleJoke[];
|
|
}
|
|
|
|
const initialState: state = {
|
|
sampleJoke: [],
|
|
recentJokes: [],
|
|
}
|
|
|
|
// @ts-ignore
|
|
export default appReducer = (state = initialState, action: Action) => {
|
|
switch (action.type) {
|
|
case SampleActionType.FETCH_SAMPLE:
|
|
return {
|
|
...state,
|
|
sampleJoke: action.payload
|
|
}
|
|
case SampleActionType.FECTH_LAST_JOKES:
|
|
return {
|
|
...state,
|
|
recentJokes: action.payload
|
|
}
|
|
|
|
default:
|
|
return state;
|
|
}
|
|
} |