update auth error message

This commit is contained in:
Dimas Atmodjo 2024-12-18 17:21:10 +07:00
parent 5d12a33489
commit 4e123cad93
3 changed files with 6 additions and 6 deletions

View File

@ -26,7 +26,7 @@ const useAuth = () => {
}
} catch (err) {
setError(err.message);
setError(err.response?.data?.message ? err.response.data.message : err.message);
} finally {
setLoading(false);
}
@ -42,7 +42,7 @@ const useAuth = () => {
setUser(decoded);
navigate(`/${decoded.role}`);
} catch (err) {
setError(err.message);
setError(err.response?.data?.message ? err.response.data.message : err.message);
} finally {
setLoading(false);
}

View File

@ -58,7 +58,7 @@ const LoginPage = () => {
<Button type="submit" variant="gd" className='w-100' disabled={loading}>
{loading ? 'Logging In...' : 'Log In'}
</Button>
{error && <p>{error}</p>}
{error && <p className="text-danger">{error}</p>}
<p className='mt-4 mb-0 text-center'>Haven't joined us yet? <Link to="/signup" className='text-blue'>Sign Up</Link> first</p>
{/* <h6 className='my-4 text-center text-muted-50'>OR</h6>
<Button variant="outline-muted" className='w-100' onClick={handleLogin}>

View File

@ -39,7 +39,7 @@ const RegisterPage = () => {
<h2 className='text-blue fw-bold'>Sign Up</h2>
<p className='text-secondary'>Lets start by creating your account first.</p>
<div className='bg-gd rounded w-100' style={{padding:"1px"}}>
<Form className='bg-white form-sm rounded p-4'>
<Form className='bg-white form-sm rounded p-4' onSubmit={handleRegister}>
<Form.Group className="mb-3" controlId="formBasicName">
<Form.Label>Full Name<span className='text-danger'>*</span></Form.Label>
<Form.Control
@ -51,7 +51,7 @@ const RegisterPage = () => {
/>
</Form.Group>
<Form.Group className="mb-3" controlId="formBasicEmail" onSubmit={handleRegister}>
<Form.Group className="mb-3" controlId="formBasicEmail">
<Form.Label>Email Address<span className='text-danger'>*</span></Form.Label>
<Form.Control
type="email"
@ -135,7 +135,7 @@ const RegisterPage = () => {
<Form.Check type="checkbox" label="Send me occasional email updates" />
</Form.Group> */}
<Button variant="gd" className="w-100" type="submit" disabled={loading} onClick={handleRegister}>
<Button variant="gd" className="w-100" type="submit" disabled={loading}>
{loading ? 'Registering...' : 'Sign Up'}
</Button>