feat: update login role from admin to agent and include loginRole in authentication request
This commit is contained in:
@@ -14,7 +14,7 @@ export default function LoginPage() {
|
||||
const [showPassword, setShowPassword] = useState(false);
|
||||
const [error, setError] = useState('');
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [userType, setUserType] = useState<'USER' | 'ADMIN'>('USER');
|
||||
const [userType, setUserType] = useState<'USER' | 'AGENT'>('USER');
|
||||
const [showResendVerification, setShowResendVerification] = useState(false);
|
||||
const [resendingVerification, setResendingVerification] = useState(false);
|
||||
const [resendSuccess, setResendSuccess] = useState('');
|
||||
@@ -74,7 +74,7 @@ export default function LoginPage() {
|
||||
const validateRes = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/auth/login`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ email, password }),
|
||||
body: JSON.stringify({ email, password, loginRole: userType }),
|
||||
});
|
||||
|
||||
const validateData = await validateRes.json();
|
||||
@@ -164,14 +164,14 @@ export default function LoginPage() {
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setUserType('ADMIN')}
|
||||
onClick={() => setUserType('AGENT')}
|
||||
className={`px-10 py-2 text-[14px] font-semibold rounded-[15px] transition-all duration-200 font-serif ${
|
||||
userType === 'ADMIN'
|
||||
userType === 'AGENT'
|
||||
? 'bg-[#00293d] text-[#f0f5fc] border border-[#00293d]'
|
||||
: 'text-[#00293d]'
|
||||
}`}
|
||||
>
|
||||
Admin
|
||||
Agent
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user