update auth error message
This commit is contained in:
parent
5d12a33489
commit
4e123cad93
|
|
@ -26,7 +26,7 @@ const useAuth = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
setError(err.message);
|
setError(err.response?.data?.message ? err.response.data.message : err.message);
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|
@ -42,7 +42,7 @@ const useAuth = () => {
|
||||||
setUser(decoded);
|
setUser(decoded);
|
||||||
navigate(`/${decoded.role}`);
|
navigate(`/${decoded.role}`);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
setError(err.message);
|
setError(err.response?.data?.message ? err.response.data.message : err.message);
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ const LoginPage = () => {
|
||||||
<Button type="submit" variant="gd" className='w-100' disabled={loading}>
|
<Button type="submit" variant="gd" className='w-100' disabled={loading}>
|
||||||
{loading ? 'Logging In...' : 'Log In'}
|
{loading ? 'Logging In...' : 'Log In'}
|
||||||
</Button>
|
</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>
|
<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>
|
{/* <h6 className='my-4 text-center text-muted-50'>OR</h6>
|
||||||
<Button variant="outline-muted" className='w-100' onClick={handleLogin}>
|
<Button variant="outline-muted" className='w-100' onClick={handleLogin}>
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ const RegisterPage = () => {
|
||||||
<h2 className='text-blue fw-bold'>Sign Up</h2>
|
<h2 className='text-blue fw-bold'>Sign Up</h2>
|
||||||
<p className='text-secondary'>Let’s start by creating your account first.</p>
|
<p className='text-secondary'>Let’s start by creating your account first.</p>
|
||||||
<div className='bg-gd rounded w-100' style={{padding:"1px"}}>
|
<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.Group className="mb-3" controlId="formBasicName">
|
||||||
<Form.Label>Full Name<span className='text-danger'>*</span></Form.Label>
|
<Form.Label>Full Name<span className='text-danger'>*</span></Form.Label>
|
||||||
<Form.Control
|
<Form.Control
|
||||||
|
|
@ -51,7 +51,7 @@ const RegisterPage = () => {
|
||||||
/>
|
/>
|
||||||
</Form.Group>
|
</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.Label>Email Address<span className='text-danger'>*</span></Form.Label>
|
||||||
<Form.Control
|
<Form.Control
|
||||||
type="email"
|
type="email"
|
||||||
|
|
@ -135,7 +135,7 @@ const RegisterPage = () => {
|
||||||
<Form.Check type="checkbox" label="Send me occasional email updates" />
|
<Form.Check type="checkbox" label="Send me occasional email updates" />
|
||||||
</Form.Group> */}
|
</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'}
|
{loading ? 'Registering...' : 'Sign Up'}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user