Commit 980ac969 authored by Цой Данил's avatar Цой Данил 💬

Added more validation to check is user authorized

parent 3c04c854
......@@ -40,7 +40,7 @@ export const UserGallery: React.FunctionComponent = (): React.ReactElement => {
const {photosByUser, targetedUser} = useSelector((state: AppState) => state.photos, shallowEqual)
const {user} = useSelector((state: AppState) => state.users, shallowEqual)
const {user, isAuth} = useSelector((state: AppState) => state.users, shallowEqual)
const navigate = useNavigate()
......@@ -102,8 +102,8 @@ export const UserGallery: React.FunctionComponent = (): React.ReactElement => {
</Fade>
</Modal>
<div style={{display: 'flex', justifyContent: 'space-between', alignItems: 'center'}}>
<h1>{targetedUser._id === user?._id ? 'This is your gallery' : `${targetedUser.username}'s gallery`}</h1>
{targetedUser._id === user?._id ?
<h1>{ isAuth && targetedUser._id === user?._id ? 'This is your gallery' : `${targetedUser.username}'s gallery`}</h1>
{isAuth && targetedUser._id === user?._id ?
<Button variant="contained" size='medium' onClick={goToAddForm}>
Add Photo
</Button> : null}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment