fix some other bugs of iam

This commit is contained in:
Montech
2026-10-11 16:01:15 +03:30
parent e4924a28f5
commit 025d223dac
227 changed files with 376 additions and 221 deletions
+4 -4
View File
@@ -162,6 +162,10 @@ const sendToken = async (otpCode: string) => {
const verified = await api.verifyOtp(String(formModel.username ?? ''), otpCode)
const { token, customer } = verified
session.login(token, customer.id, customer.mobile)
if (verified.iamBootstrapUrl) {
window.location.assign(verified.iamBootstrapUrl)
return
}
// D21 — ask the server which kind of principal this token is, so the
// expert-only entries appear for a sales expert. Failure is non-fatal:
// the entries simply stay hidden, and the server refuses those routes
@@ -172,10 +176,6 @@ const sendToken = async (otpCode: string) => {
} catch {
session.setSalesExpert(false)
}
if (verified.iamBootstrapUrl) {
window.location.assign(verified.iamBootstrapUrl)
return
}
const redirect = typeof route.query.redirect === 'string' ? route.query.redirect : undefined
await router.push(redirect ?? { name: 'home' })
toast.success('با موفقیت وارد شدید')