Skip to content

Instantly share code, notes, and snippets.

@Waksuu
Created March 25, 2020 20:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Waksuu/eabacd0f886441b16735aeb7bfda50c7 to your computer and use it in GitHub Desktop.
Save Waksuu/eabacd0f886441b16735aeb7bfda50c7 to your computer and use it in GitHub Desktop.
export const retrieveMoviesAction = (): ThunkAction<Promise<void>,
AppState,
undefined,
AppActions
> => async (dispatch: ThunkDispatch<AppState, undefined, AppActions>) => {
const movies: MovieDTO[] = await getAllMoviesREST();
dispatch(moviesRetrieved(movies));
};
const moviesRetrieved = (movies: MovieDTO[]): RetrieveMovieListAction => ({
type: MovieListRetrieved,
movies
});
export const clearMovies = (): ClearMovieListAction => ({
type: ClearMovieListRequest,
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment