Skip to content

Commit

Permalink
preventing double submit
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandyrzph committed Aug 12, 2022
1 parent e633f6f commit c6ca4b6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion pixelplace/src/components/Auth/SignIn.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const SignIn = () => {
validationSchema={SignInSchema}
onSubmit={(values) => handleSubmit(values)}
>
{({ errors, touched }) => (
{({ errors, touched, isSubmitting }) => (
<Form className="relative w-full mx-auto h-screen pt-[100px] max-w-xs sm:max-w-sm md:max-w-lg lg:max-w-3xl">
<h1 className="relative text-[80px] md:text-[120px] text-5xl -z-10 -mb-[10px] font-logo">
Sign <span className="text-stroke text-white">In</span>
Expand Down Expand Up @@ -71,6 +71,7 @@ const SignIn = () => {
<div className="mt-4 w-full">
<button
type="submit"
disabled={isSubmitting}
className="relative flex-grow-1 w-full lg:w-full hover:shadow-neu-shadow hover:-translate-y-1 duration-200 border-2 border-neu-black px-6 py-3 rounded-sm bg-neu-yellow font-bold"
>
Log in
Expand Down
3 changes: 2 additions & 1 deletion pixelplace/src/components/Auth/SignUp.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const SignUp = () => {
validationSchema={SignUpSchema}
onSubmit={(values) => handleSubmit(values)}
>
{({ errors, touched, setFieldValue }) => (
{({ errors, touched, isSubmitting, setFieldValue }) => (
<Form className="w-full mx-auto h-screen pt-[100px] max-w-xs sm:max-w-sm md:max-w-lg lg:max-w-3xl">
<h1 className="relative text-[80px] md:text-[120px] text-5xl -z-10 -mb-[10px] font-logo">
Sign <span className="text-stroke text-white">Up</span>
Expand Down Expand Up @@ -211,6 +211,7 @@ const SignUp = () => {
<div className="w-full mt-4">
<button
type="submit"
disabled={isSubmitting}
className="relative flex-grow-1 w-full lg:w-full hover:shadow-neu-shadow hover:-translate-y-1 duration-200 border-2 border-neu-black px-6 py-3 rounded-sm bg-neu-yellow font-bold"
>
Sign Up
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const PostCreateForm = () => {
validationSchema={CreateEditPostSchema}
onSubmit={(values) => handleSubmit(values)}
>
{({ touched, errors, setFieldValue }) => (
{({ touched, errors, isSubmitting, setFieldValue }) => (
<Form className="w-full mx-auto h-screen pt-[100px] max-w-xs sm:max-w-sm md:max-w-lg lg:max-w-3xl">
<h1 className="relative text-[100px] text-5xl -z-10 -mb-[10px] font-logo">
Create <span className="text-stroke text-white">Post</span>
Expand Down Expand Up @@ -189,6 +189,7 @@ const PostCreateForm = () => {
<div className="mt-4 w-full">
<button
type="Submit"
disabled={isSubmitting}
className="relative flex-grow-1 w-full lg:w-full hover:shadow-neu-shadow hover:-translate-y-1 duration-200 border-2 outline-none border-neu-black px-6 py-3 rounded-sm bg-neu-yellow font-bold"
>
Submit
Expand Down
3 changes: 2 additions & 1 deletion pixelplace/src/components/Posts/PostEditForm/PostEditForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const PostEditForm = () => {
validationSchema={CreateEditPostSchema}
onSubmit={(values) => handleSubmit(values)}
>
{({ values, touched, errors, setFieldValue }) => (
{({ values, touched, errors, isSubmitting, setFieldValue }) => (
<Form className="w-full mx-auto h-screen pt-[100px] max-w-xs sm:max-w-sm md:max-w-lg lg:max-w-3xl">
<h1 className="relative text-[100px] text-5xl -z-10 -mb-[10px] font-logo">
Edit <span className="text-stroke text-white">Post</span>
Expand Down Expand Up @@ -208,6 +208,7 @@ const PostEditForm = () => {
<div className="mt-4 w-full">
<button
type="Submit"
disabled={isSubmitting}
className="relative flex-grow-1 w-full lg:w-full hover:shadow-neu-shadow hover:-translate-y-1 duration-200 border-2 outline-none border-neu-black px-6 py-3 rounded-sm bg-neu-yellow font-bold"
>
Submit
Expand Down

0 comments on commit c6ca4b6

Please sign in to comment.