fix(license): 试用态隐藏「退出授权」——试用不是授权,点了必报'当前未激活'
canDeactivate 改为:有正式授权(plan=pro 且非 trial)且 admin 才显示; 试用态(库内无码)显示试用提示条而非退出按钮(实测复现:试用态点击退出 toast 报'当前未激活授权',按钮又因 pro=true 未消失,看似'点击没反应')
This commit is contained in:
1 parent
9a477e9c9b
commit
897899305f
1 file changed
+3
-1
@@ -19,7 +19,9 @@ export const LicenseSection = memo(function LicenseSection() {
|
||||
const { t } = useTranslation('license')
|
||||
const { pro, info, reload } = useLicense()
|
||||
const isAdmin = getUser()?.role === 'admin'
|
||||
const canDeactivate = Boolean(pro) && isAdmin
|
||||
// 退出授权只对已激活的正式授权有意义;试用态(库内无码)点了必然报"未激活",隐藏按钮
|
||||
const hasFormalLicense = Boolean(info && info.plan === 'pro' && !info.trial?.active)
|
||||
const canDeactivate = hasFormalLicense && isAdmin
|
||||
const [key, setKey] = useState('')
|
||||
const [activating, setActivating] = useState(false)
|
||||
const [confirmOpen, setConfirmOpen] = useState(false)
|
||||
|
||||
Reference in new issue
Block a user