Skip to content

Commit

Permalink
fixed route guard
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandyrzph committed Aug 2, 2022
1 parent 13c2cf4 commit d0dd9c5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pixelplace/src/components/Forms/PostEditForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ const PostEditForm = () => {
.catch((err) => console.log(err));
}, [postId]);

if (post?.ownerId !== user.uid) {

if (post && post?.ownerId !== user.uid) {
return <Navigate to="/" />;
}

const uploadImage = async (image) => {
const imageRef = ref(storage, `${new Date().getTime() + image.name}`);
try {
Expand Down

0 comments on commit d0dd9c5

Please sign in to comment.