diff --git a/client/components/new-post/password/index.tsx b/client/components/new-post/password/index.tsx index fca2bba8..267a1220 100644 --- a/client/components/new-post/password/index.tsx +++ b/client/components/new-post/password/index.tsx @@ -2,24 +2,24 @@ import { Input, Modal, Note, Spacer } from "@geist-ui/core" import { useState } from "react" type Props = { - warning?: boolean + creating?: boolean isOpen: boolean onClose: () => void onSubmit: (password: string) => void } -const PasswordModal = ({ isOpen, onClose, onSubmit: onSubmitAfterVerify, warning }: Props) => { +const PasswordModal = ({ isOpen, onClose, onSubmit: onSubmitAfterVerify, creating }: Props) => { const [password, setPassword] = useState() const [confirmPassword, setConfirmPassword] = useState() const [error, setError] = useState() const onSubmit = () => { - if (!password || !confirmPassword) { + if (!password || (creating && !confirmPassword)) { setError('Please enter a password') return } - if (password !== confirmPassword) { + if (password !== confirmPassword && creating) { setError("Passwords do not match") return } @@ -31,7 +31,7 @@ const PasswordModal = ({ isOpen, onClose, onSubmit: onSubmitAfterVerify, warning { Enter a password - {!error && warning && + {!error && creating && This doesn't protect your post from the server administrator. } {error && @@ -39,7 +39,7 @@ const PasswordModal = ({ isOpen, onClose, onSubmit: onSubmitAfterVerify, warning } setPassword(e.target.value)} /> - setConfirmPassword(e.target.value)} /> + {creating && setConfirmPassword(e.target.value)} />} Cancel Submit diff --git a/client/pages/post/protected/[id].tsx b/client/pages/post/protected/[id].tsx index 72c49790..05ccf4b2 100644 --- a/client/pages/post/protected/[id].tsx +++ b/client/pages/post/protected/[id].tsx @@ -91,7 +91,7 @@ const Post = ({ theme, changeTheme }: ThemeProps) => { } if (!post) { - return + return } return (