-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
479 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { Box, Button, Divider, Skeleton, Stack } from '@mui/material'; | ||
import Grid from '@mui/material/Unstable_Grid2'; // Grid version 2 | ||
import { pokemonApi, useFetchRegionListQuery } from '../store/pokemon.api'; | ||
import Region from '../region/Region'; | ||
import RefreshIcon from '@mui/icons-material/Refresh'; | ||
import { useAppDispatch } from '../../store/appHook'; | ||
|
||
function FilmsAll() { | ||
const dispatch = useAppDispatch(); | ||
const { data, isFetching, isLoading, refetch } = useFetchRegionListQuery(); | ||
|
||
const handleRefresh = () => { | ||
//dispatch(pokemonApi.util.invalidateTags([{type: PokemonTag}])); | ||
dispatch(pokemonApi.util.invalidateTags([{type: "Region", id: 'ALL'}])); | ||
//refetch(); | ||
}; | ||
|
||
if (isLoading) { | ||
return ( | ||
<Box width="100%"> | ||
<Skeleton animation="wave" /> | ||
<Skeleton animation="wave" /> | ||
</Box> | ||
); | ||
} | ||
|
||
if (!data) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<Box width="100%"> | ||
<Stack direction="row" justifyContent="start" alignItems="start" width="100%"> | ||
<Button startIcon={ <RefreshIcon /> } variant='text' onClick={ handleRefresh }> | ||
Refresh | ||
</Button> | ||
</Stack> | ||
<Divider flexItem variant='fullWidth' /> | ||
<Grid container xs={ 12 } columnSpacing={ 2 }> | ||
{ | ||
data.map((res) => { | ||
return ( | ||
<Grid xs={ 4 } key={ res }> | ||
<Region regionId={ res } /> | ||
</Grid> | ||
); | ||
}) | ||
} | ||
</Grid> | ||
<Divider flexItem variant='fullWidth' /> | ||
</Box> | ||
); | ||
} | ||
|
||
export default FilmsAll; |
Oops, something went wrong.