fix
This commit is contained in:
@@ -297,11 +297,19 @@ export default function AgentDashboard() {
|
||||
const handleSubmitVerification = async () => {
|
||||
setIsSubmittingVerification(true);
|
||||
try {
|
||||
await usersService.submitForVerification();
|
||||
// Update local state
|
||||
const result = await usersService.submitForVerification();
|
||||
console.log('Verification submit result:', result);
|
||||
// Update local state immediately
|
||||
if (agentProfile) {
|
||||
setAgentProfile({ ...agentProfile, verificationStatus: 'PENDING_REVIEW', verificationNote: null } as AgentProfile);
|
||||
}
|
||||
// Also re-fetch profile to confirm
|
||||
try {
|
||||
const freshProfile = await agentsService.getProfile();
|
||||
setAgentProfile(freshProfile);
|
||||
} catch {
|
||||
// Local state already updated
|
||||
}
|
||||
} catch (err: any) {
|
||||
const data = err?.response?.data;
|
||||
if (data?.missingFields && Array.isArray(data.missingFields)) {
|
||||
@@ -328,18 +336,9 @@ export default function AgentDashboard() {
|
||||
<p className="font-serif text-[13px] text-red-700 mt-1">Reason: {agentProfile.verificationNote}</p>
|
||||
)}
|
||||
<p className="font-serif text-[13px] text-red-600 mt-2">Please update your profile and documents, then resubmit for verification.</p>
|
||||
<div className="flex gap-2 mt-2">
|
||||
<Link href="/agent/edit" className="inline-block px-4 py-1.5 border border-[#e58625] text-[#e58625] rounded-[10px] font-serif text-[13px] hover:bg-[#e58625]/5 transition-colors">
|
||||
Edit Profile
|
||||
</Link>
|
||||
<button
|
||||
onClick={handleSubmitVerification}
|
||||
disabled={isSubmittingVerification}
|
||||
className="px-4 py-1.5 bg-[#e58625] text-white rounded-[10px] font-serif text-[13px] hover:bg-[#d47920] transition-colors disabled:opacity-50"
|
||||
>
|
||||
{isSubmittingVerification ? 'Submitting...' : 'Submit for Review'}
|
||||
</button>
|
||||
</div>
|
||||
<Link href="/agent/edit" className="inline-block mt-2 px-4 py-1.5 bg-[#e58625] text-white rounded-[10px] font-serif text-[13px] hover:bg-[#d47920] transition-colors">
|
||||
Edit & Resubmit
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -352,24 +351,15 @@ export default function AgentDashboard() {
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{agentProfile?.verificationStatus === 'NONE' && (
|
||||
{(!agentProfile?.verificationStatus || agentProfile?.verificationStatus === 'NONE') && (
|
||||
<div className="bg-blue-50 border border-blue-200 rounded-[15px] p-4">
|
||||
<div className="flex items-center gap-3">
|
||||
<Image src="/assets/icons/caution-icon.svg" alt="Info" width={20} height={20} className="flex-shrink-0" />
|
||||
<div className="flex-1">
|
||||
<p className="font-fractul font-bold text-[14px] text-blue-800">Complete your profile and upload verification documents to get verified.</p>
|
||||
<div className="flex gap-2 mt-2">
|
||||
<Link href="/agent/edit" className="inline-block px-4 py-1.5 border border-[#e58625] text-[#e58625] rounded-[10px] font-serif text-[13px] hover:bg-[#e58625]/5 transition-colors">
|
||||
Complete Profile
|
||||
</Link>
|
||||
<button
|
||||
onClick={handleSubmitVerification}
|
||||
disabled={isSubmittingVerification}
|
||||
className="px-4 py-1.5 bg-[#e58625] text-white rounded-[10px] font-serif text-[13px] hover:bg-[#d47920] transition-colors disabled:opacity-50"
|
||||
>
|
||||
{isSubmittingVerification ? 'Submitting...' : 'Submit for Review'}
|
||||
</button>
|
||||
</div>
|
||||
<p className="font-fractul font-bold text-[14px] text-blue-800">Complete your profile to get verified.</p>
|
||||
<Link href="/agent/edit" className="inline-block mt-2 px-4 py-1.5 bg-[#e58625] text-white rounded-[10px] font-serif text-[13px] hover:bg-[#d47920] transition-colors">
|
||||
Complete Profile
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user