Keep the last shows fetched URL
This commit is contained in:
parent
fce19bf3d8
commit
614d1ab11e
@ -175,14 +175,10 @@ export function fetchMovies(url) {
|
||||
export function fetchShows(url) {
|
||||
return request(
|
||||
'SHOW_LIST_FETCH',
|
||||
configureAxios().get(url)
|
||||
)
|
||||
}
|
||||
|
||||
export function searchShows(search) {
|
||||
return request(
|
||||
'SEARCH_SHOWS',
|
||||
configureAxios().post('/shows/search', search)
|
||||
configureAxios().get(url),
|
||||
[
|
||||
updateLastShowsFetchUrl(url),
|
||||
]
|
||||
)
|
||||
}
|
||||
|
||||
@ -256,13 +252,6 @@ export function updateShowWishlistStore(imdbId, wishlisted, season = null, episo
|
||||
}
|
||||
}
|
||||
|
||||
export function exploreShows(source, category) {
|
||||
return request(
|
||||
'EXPLORE_SHOWS',
|
||||
configureAxios().get(`/shows/explore?source=${encodeURI(source)}&category=${encodeURI(category)}`)
|
||||
)
|
||||
}
|
||||
|
||||
export function getShowExploreOptions() {
|
||||
return request(
|
||||
'SHOW_GET_EXPLORE_OPTIONS',
|
||||
@ -277,6 +266,15 @@ export function selectShow(imdbId) {
|
||||
}
|
||||
}
|
||||
|
||||
export function updateLastShowsFetchUrl(url) {
|
||||
return {
|
||||
type: 'UPDATE_LAST_SHOWS_FETCH_URL',
|
||||
payload: {
|
||||
url: url,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// ======================
|
||||
// AddTorrent
|
||||
// ======================
|
||||
|
@ -133,7 +133,9 @@ const routes = {
|
||||
if (Object.keys(state.movieStore.exploreOptions).length === 0) {
|
||||
store.dispatch(actionCreators.getMovieExploreOptions());
|
||||
}
|
||||
store.dispatch(actionCreators.fetchMovies(`/movies/explore?source=${nextState.params.source}&category=${nextState.params.category}`));
|
||||
store.dispatch(actionCreators.fetchMovies(
|
||||
`/movies/explore?source=${encodeURI(nextState.params.source)}&category=${encodeURI(nextState.params.category)}`
|
||||
));
|
||||
});
|
||||
},
|
||||
},
|
||||
@ -192,7 +194,9 @@ const routes = {
|
||||
if (Object.keys(state.showStore.exploreOptions).length === 0) {
|
||||
store.dispatch(actionCreators.getShowExploreOptions());
|
||||
}
|
||||
store.dispatch(actionCreators.fetchShows(`/shows/explore?source=${nextState.params.source}&category=${nextState.params.category}`));
|
||||
store.dispatch(actionCreators.fetchShows(
|
||||
`/shows/explore?source=${encodeURI(nextState.params.source)}&category=${encodeURI(nextState.params.category)}`
|
||||
));
|
||||
});
|
||||
},
|
||||
},
|
||||
|
@ -9,6 +9,7 @@ const defaultState = {
|
||||
},
|
||||
search: "",
|
||||
getDetails: false,
|
||||
lastShowsFetchUrl: "",
|
||||
exploreOptions: {},
|
||||
};
|
||||
|
||||
@ -73,6 +74,10 @@ export default function showStore(state = defaultState, action) {
|
||||
shows: updateShowsStoreWishlist(state.shows.slice(), action.payload),
|
||||
show: updateShowStoreWishlist(Object.assign({}, state.show), action.payload),
|
||||
})
|
||||
case 'UPDATE_LAST_SHOWS_FETCH_URL':
|
||||
return Object.assign({}, state, {
|
||||
lastShowsFetchUrl: action.payload.url,
|
||||
})
|
||||
case 'SELECT_SHOW':
|
||||
// Don't select the show if we're fetching another show's details
|
||||
if (state.fetchingDetails) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user