|
|
@@ -1,4 +1,5 @@
|
|
|
import { NextPage } from "next";
|
|
|
+import FormResponse from "../components/FormResponse";
|
|
|
import Layout from "../components/Layout";
|
|
|
import Spinner from "../components/Spinner";
|
|
|
import useForm from "../hooks/useForm";
|
|
|
@@ -40,16 +41,12 @@ const SignUp: NextPage = () => {
|
|
|
<button type="submit" className="form-button" disabled={loading}>
|
|
|
{loading ? <Spinner /> : "Sign up"}
|
|
|
</button>
|
|
|
- {error && !success && (
|
|
|
- <div role="alert" className="form-alert-msg">
|
|
|
- {error.message}
|
|
|
- </div>
|
|
|
- )}
|
|
|
- {success && (
|
|
|
- <div role="alert" className="form-success-msg">
|
|
|
- User created correctly! Please, log in to continue
|
|
|
- </div>
|
|
|
- )}
|
|
|
+ <FormResponse
|
|
|
+ error={error}
|
|
|
+ success={success}
|
|
|
+ loading={loading}
|
|
|
+ fallbackSuccessMessage="User created correctly! Please, log in to continue"
|
|
|
+ />
|
|
|
</form>
|
|
|
</Layout>
|
|
|
);
|