From dcde20f170bc39a79d6773a607335938d14d7ceb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Delattre?= Date: Tue, 31 Jan 2017 20:43:41 +0100 Subject: [PATCH] Add button to refresh the show details --- src/public/js/actions/actionCreators.js | 7 +++++++ src/public/js/components/shows/list.js | 2 ++ src/public/js/components/shows/listButtons.js | 9 ++++++++- src/public/js/reducers/shows.js | 16 ++++++++++++++++ 4 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/public/js/actions/actionCreators.js b/src/public/js/actions/actionCreators.js index 1f4591d..3200f63 100644 --- a/src/public/js/actions/actionCreators.js +++ b/src/public/js/actions/actionCreators.js @@ -181,6 +181,13 @@ export function searchShows(search) { ) } +export function getShowDetails(imdbId) { + return request( + 'SHOW_GET_DETAILS', + configureAxios().post(`/shows/${imdbId}/refresh`) + ) +} + export function fetchShowDetails(imdbId) { return request( 'SHOW_FETCH_DETAILS', diff --git a/src/public/js/components/shows/list.js b/src/public/js/components/shows/list.js index 3704260..dce38bb 100644 --- a/src/public/js/components/shows/list.js +++ b/src/public/js/components/shows/list.js @@ -58,6 +58,8 @@ export default class ShowList extends React.Component { show={selectedShow} deleteFromWishlist={this.props.deleteShowFromWishlist} addToWishlist={this.props.addShowToWishlist} + getDetails={this.props.getShowDetails} + fetching={this.props.showStore.getDetails} /> } diff --git a/src/public/js/components/shows/listButtons.js b/src/public/js/components/shows/listButtons.js index d7baed3..34ec5ed 100644 --- a/src/public/js/components/shows/listButtons.js +++ b/src/public/js/components/shows/listButtons.js @@ -3,7 +3,7 @@ import React from 'react' import { Link } from 'react-router' import { DropdownButton } from 'react-bootstrap' -import { WishlistButton } from '../buttons/actions' +import { WishlistButton, RefreshButton } from '../buttons/actions' export default function ShowButtons(props) { const imdbLink = `http://www.imdb.com/title/${props.show.imdb_id}`; @@ -13,6 +13,8 @@ export default function ShowButtons(props) { show={props.show} addToWishlist={props.addToWishlist} deleteFromWishlist={props.deleteFromWishlist} + getDetails={props.getDetails} + fetching={props.fetching} /> IMDB @@ -28,6 +30,11 @@ function ActionsButton(props) { let wishlisted = (props.show.tracked_season !== null && props.show.tracked_episode !== null); return ( + el.imdb_id).indexOf(data.imdb_id); + shows[index] = data; + return shows +}