Add movies from polochon
This commit is contained in:
parent
0e6b05a8c8
commit
466c3f4295
@ -69,9 +69,9 @@ export function getUserInfos() {
|
||||
)
|
||||
}
|
||||
|
||||
export function fetchMovies() {
|
||||
export function fetchMovies(url) {
|
||||
return request(
|
||||
'MOVIE_LIST_FETCH',
|
||||
configureAxios().get('/movies/explore/popular')
|
||||
configureAxios().get(url)
|
||||
)
|
||||
}
|
||||
|
@ -66,6 +66,14 @@ const UserIsAuthenticated = UserAuthWrapper({
|
||||
failureRedirectPath: '/users/login',
|
||||
})
|
||||
|
||||
// TODO find a better way
|
||||
const MovieListPopular = (props) => (
|
||||
<MovieList {...props} moviesUrl='/movies/explore/popular'/>
|
||||
)
|
||||
const MovieListPolochon = (props) => (
|
||||
<MovieList {...props} moviesUrl='/movies/polochon'/>
|
||||
)
|
||||
|
||||
ReactDOM.render((
|
||||
<Provider store={store}>
|
||||
<Router history={history}>
|
||||
@ -74,7 +82,8 @@ ReactDOM.render((
|
||||
<Route path="/users/login" component={UserLoginForm} />
|
||||
<Route path="/users/signup" component={UserSignUp} />
|
||||
<Route path="/users/edit" component={UserIsAuthenticated(UserEdit)} />
|
||||
<Route path="/movies/popular" component={UserIsAuthenticated(MovieList)} />
|
||||
<Route path="/movies/popular" component={UserIsAuthenticated(MovieListPopular)} />
|
||||
<Route path="/movies/polochon" component={UserIsAuthenticated(MovieListPolochon)} />
|
||||
</Route>
|
||||
</Router>
|
||||
</Provider>
|
||||
|
@ -57,7 +57,7 @@ function MovieDetails(props) {
|
||||
|
||||
export default class MovieList extends React.Component {
|
||||
componentWillMount() {
|
||||
this.props.fetchMovies();
|
||||
this.props.fetchMovies(this.props.moviesUrl);
|
||||
}
|
||||
render() {
|
||||
const movies = this.props.movieStore.movies;
|
||||
|
@ -22,7 +22,10 @@ export default class NavBar extends React.Component {
|
||||
<Navbar.Collapse>
|
||||
<Nav>
|
||||
<LinkContainer to="/movies/popular">
|
||||
<NavItem>Movies</NavItem>
|
||||
<NavItem>Popular movies</NavItem>
|
||||
</LinkContainer>
|
||||
<LinkContainer to="/movies/polochon">
|
||||
<NavItem>Polochon movies</NavItem>
|
||||
</LinkContainer>
|
||||
</Nav>
|
||||
<Nav pullRight>
|
||||
|
Loading…
x
Reference in New Issue
Block a user