From f1690f2daa3688047f0ee2996aeb44ffebed4f34 Mon Sep 17 00:00:00 2001 From: tylim Date: Tue, 21 May 2019 19:19:54 +0800 Subject: [PATCH] remove final form focus because there is issue with it https://github.com/final-form/final-form-focus/issues/8 --- package-lock.json | 5 ----- package.json | 1 - src/views/SignUpPage.jsx | 14 ++++++-------- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/package-lock.json b/package-lock.json index b5dd7016..4c5d75b7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6903,11 +6903,6 @@ "@babel/runtime": "^7.3.1" } }, - "final-form-focus": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/final-form-focus/-/final-form-focus-1.1.2.tgz", - "integrity": "sha512-Gd+Bd2Ll7ijo3/sd6kJ/bwLkhc2bUJPxTON6fIqee/008EJpACWhT+zoWCm9q6NcfMcWRS+Sp5ikRX8iqdXeGQ==" - }, "finalhandler": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz", diff --git a/package.json b/package.json index 107efdda..0f0ceda8 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,6 @@ "chart.js": "^2.7.3", "classnames": "^2.2.6", "final-form": "^4.12.0", - "final-form-focus": "^1.1.2", "firebase": "^6.0.2", "ky": "^0.10.0", "localforage": "^1.7.3", diff --git a/src/views/SignUpPage.jsx b/src/views/SignUpPage.jsx index 2578aee7..46d3bc8d 100644 --- a/src/views/SignUpPage.jsx +++ b/src/views/SignUpPage.jsx @@ -5,7 +5,6 @@ import firebase from 'firebase' // form validation import { Form as FinalForm } from 'react-final-form' import { string, boolean } from 'yup' -import createDecorator from 'final-form-focus' // state management import { Subscribe } from 'unstated' @@ -33,8 +32,6 @@ import IndexNavbar from 'components/Navbars/IndexNavbar.jsx' import Footer from 'components/Footer/Footer.jsx' import InputField from 'components/InputField/InputField' -const focusOnError = createDecorator() - class SignUpPage extends React.Component { state = { squares1to6: '', @@ -124,16 +121,14 @@ class SignUpPage extends React.Component { password: '', term: false, }} - decorators={[focusOnError]} - onSubmit={(values, actions) => { - firebase + onSubmit={values => { + return firebase .auth() .createUserWithEmailAndPassword( values.email, values.password ) .then(credential => { - actions.setSubmitting(false) if ( credential.user && credential.user.emailVerified === false @@ -145,10 +140,13 @@ class SignUpPage extends React.Component { 'email verification sent to user' ) }) + .catch(error => { + console.log('email user failed', error) + }) } }) .catch(error => { - console.log(error) + console.log('submit failed', error) }) }}> {({ handleSubmit, submitting, validating }) => (