diff --git a/src/SubmitContentBox.tsx b/src/SubmitContentBox.tsx index d8f9f055..53c42e51 100644 --- a/src/SubmitContentBox.tsx +++ b/src/SubmitContentBox.tsx @@ -31,6 +31,7 @@ const SubmitContentBox: React.FC = ({ }) => { const [showModal, setShowModal] = useState(false); const [isValidUser, setIsValidUser] = useState(false); + const [isSubmitting, setIsSubmitting] = useState(false); const handleTurnstileValidation = (isValid: boolean) => { setIsValidUser(isValid); @@ -40,6 +41,7 @@ const SubmitContentBox: React.FC = ({ const handleSubmit = async () => { + setIsSubmitting(true); try { const response = await fetch("/maketext", { method: 'POST', @@ -71,6 +73,9 @@ const SubmitContentBox: React.FC = ({ } catch (error) { console.error('投稿エラー:', error); alert('投稿中にエラーが発生しました。'); + } finally { + setIsSubmitting(false); + setShowModal(false); } }; @@ -79,7 +84,7 @@ const SubmitContentBox: React.FC = ({
handleTurnstileValidation(true)} />
- setShowModal(false)}> @@ -88,16 +93,15 @@ const SubmitContentBox: React.FC = ({ 本当に投稿しますか? - - ); }; - export default SubmitContentBox; \ No newline at end of file