diff options
author | 2021-09-02 22:28:11 +0200 | |
---|---|---|
committer | 2021-09-02 23:54:56 +0200 | |
commit | f08f6ca0a9d337efff280d4d1669a41b5d9c31c2 (patch) | |
tree | 7dee778ba742deb5f499f2aa08a1ba040606d633 /pages/login.js | |
parent | 9f74c550927671f4ded301d0cf3e9d592716375c (diff) | |
download | my_apps-f08f6ca0a9d337efff280d4d1669a41b5d9c31c2.tar.gz my_apps-f08f6ca0a9d337efff280d4d1669a41b5d9c31c2.tar.bz2 my_apps-f08f6ca0a9d337efff280d4d1669a41b5d9c31c2.zip |
finish translations, force maximize
Diffstat (limited to 'pages/login.js')
-rw-r--r-- | pages/login.js | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/pages/login.js b/pages/login.js index 3fb2df6..533e8e8 100644 --- a/pages/login.js +++ b/pages/login.js @@ -1,24 +1,33 @@ -import { useState } from 'react' -import useUser from 'lib/useUser' +import {useState} from 'react' +import useUser from 'hooks/useUser' import submitForm from 'helpers/submitForm' -import {Layout, Form} from 'components' +import {Layout, Form, Splash} from 'components' const Login = () => { + const [errorMsg, setErrorMsg] = useState('') + const [loading, setLoading] = useState(false) const {mutateUser} = useUser({ redirectToVerify: true, redirectToApps: true, }) - const [errorMsg, setErrorMsg] = useState('') - const handleSubmit = e => submitForm(e, '/api/login', mutateUser, setErrorMsg) + const handleSubmit = async e => { + setLoading(true) + await submitForm(e, '/api/login', mutateUser, setErrorMsg) + setLoading(false) + } return ( <Layout> - <Form - isLogin - errorMessage={errorMsg} - onSubmit={handleSubmit} - /> + {loading + ? <Splash fixed /> + : ( + <Form + isLogin + errorMessage={errorMsg} + onSubmit={handleSubmit} + /> + )} </Layout> ) } |