Skip to content

Commit

Permalink
Se corrige bug de vista detalles desde favs
Browse files Browse the repository at this point in the history
  • Loading branch information
DannitaZz committed Feb 2, 2022
1 parent 827c65b commit d580440
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function App() {
<BrowserRouter>
<Routes>
<Route exact path='/' element={<Pokemon favs={state.favIds} actionName={'setMainPage'} data={state.data} page={state.mainPage.page} dispatch={dispatch} />} />
<Route exact path='/details/:id' element={<Details pokemon={state.pokemon} dispatch={dispatch} />} />
<Route exact path='/:id' element={<Details pokemon={state.pokemon} dispatch={dispatch} />} />
<Route exact path='/favorites' element={<Pokemon favs={state.favIds} actionName={'setFavPage'} data={state.favs} page={state.favPage.page} dispatch={dispatch} />} />
{/* <Route exact path='/favorites' element={<Favorites state={state} dispatch={dispatch} />} /> */}
</Routes>
Expand Down
4 changes: 2 additions & 2 deletions src/components/navbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ const ResponsiveAppBar = () => {

const navigateToRepo_ = (e) => {
const { value } = e.target.innerText;
if (e.target.innerText === 'Repositories'){
navigateTo('/pokemon');
if (e.target.innerText === 'Pokémon'){
navigateTo('/');
}
else if (e.target.innerText=== 'Favorites') {
navigateTo('/favorites');
Expand Down
2 changes: 2 additions & 0 deletions src/components/pages/details.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import ResponsiveAppBar from "../navbar"
import Pokedetails from "../pokedetails"


Expand All @@ -6,6 +7,7 @@ function Details({pokemon, dispatch}) {

return (
<>
<ResponsiveAppBar />
<h1>Vista detalles</h1>
<Pokedetails pokemon={pokemon} dispatch={dispatch}/>
</>
Expand Down
2 changes: 1 addition & 1 deletion src/components/pokelist.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function Pokelist({ favs, data, page, pageSize, dispatch }) {
function handleClick(e) {
const id = e.currentTarget.value
console.log('id', id)
navigateTo(`details/${id}`);
navigateTo(`/${id}`);
}
return (
<div style={{ width: '100vw', display: 'flex', flexDirection: 'row', flexFlow: 'row wrap', justifyContent: 'center' }}>
Expand Down

0 comments on commit d580440

Please sign in to comment.