fix(admin-web): use AUTHORIZED instead of ACTIVE for authorization status
The backend returns status as 'AUTHORIZED'/'REVOKED' but frontend was checking for 'ACTIVE'. Fixed all status comparisons to use correct value. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
af0b9d38c0
commit
f77ecff659
|
|
@ -24,7 +24,7 @@ import styles from './authorization.module.scss';
|
||||||
export default function AuthorizationPage() {
|
export default function AuthorizationPage() {
|
||||||
// 筛选状态
|
// 筛选状态
|
||||||
const [filterType, setFilterType] = useState<RoleType | ''>('');
|
const [filterType, setFilterType] = useState<RoleType | ''>('');
|
||||||
const [filterStatus, setFilterStatus] = useState<'ACTIVE' | 'REVOKED' | ''>('');
|
const [filterStatus, setFilterStatus] = useState<'AUTHORIZED' | 'REVOKED' | ''>('');
|
||||||
const [searchKeyword, setSearchKeyword] = useState('');
|
const [searchKeyword, setSearchKeyword] = useState('');
|
||||||
const [page, setPage] = useState(1);
|
const [page, setPage] = useState(1);
|
||||||
const limit = 20;
|
const limit = 20;
|
||||||
|
|
@ -47,7 +47,7 @@ export default function AuthorizationPage() {
|
||||||
const queryParams = useMemo(() => ({
|
const queryParams = useMemo(() => ({
|
||||||
roleType: filterType || undefined,
|
roleType: filterType || undefined,
|
||||||
keyword: searchKeyword || undefined,
|
keyword: searchKeyword || undefined,
|
||||||
includeRevoked: filterStatus === 'REVOKED' ? true : filterStatus === '' ? true : false,
|
includeRevoked: filterStatus === 'REVOKED' || filterStatus === '',
|
||||||
page,
|
page,
|
||||||
limit,
|
limit,
|
||||||
}), [filterType, searchKeyword, filterStatus, page]);
|
}), [filterType, searchKeyword, filterStatus, page]);
|
||||||
|
|
@ -266,13 +266,13 @@ export default function AuthorizationPage() {
|
||||||
className={styles.authorization__select}
|
className={styles.authorization__select}
|
||||||
value={filterStatus}
|
value={filterStatus}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
setFilterStatus(e.target.value as 'ACTIVE' | 'REVOKED' | '');
|
setFilterStatus(e.target.value as 'AUTHORIZED' | 'REVOKED' | '');
|
||||||
setPage(1);
|
setPage(1);
|
||||||
}}
|
}}
|
||||||
aria-label="授权状态"
|
aria-label="授权状态"
|
||||||
>
|
>
|
||||||
<option value="">全部状态</option>
|
<option value="">全部状态</option>
|
||||||
<option value="ACTIVE">有效</option>
|
<option value="AUTHORIZED">有效</option>
|
||||||
<option value="REVOKED">已撤销</option>
|
<option value="REVOKED">已撤销</option>
|
||||||
</select>
|
</select>
|
||||||
<input
|
<input
|
||||||
|
|
@ -452,12 +452,12 @@ export default function AuthorizationPage() {
|
||||||
<span
|
<span
|
||||||
className={cn(
|
className={cn(
|
||||||
styles.authorization__badge,
|
styles.authorization__badge,
|
||||||
item.status === 'ACTIVE'
|
item.status === 'AUTHORIZED'
|
||||||
? styles['authorization__badge--authorized']
|
? styles['authorization__badge--authorized']
|
||||||
: styles['authorization__badge--revoked']
|
: styles['authorization__badge--revoked']
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{item.status === 'ACTIVE' ? '有效' : '已撤销'}
|
{item.status === 'AUTHORIZED' ? '有效' : '已撤销'}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
|
|
@ -466,7 +466,7 @@ export default function AuthorizationPage() {
|
||||||
styles['authorization__tableCell--actions']
|
styles['authorization__tableCell--actions']
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{item.status === 'ACTIVE' && (
|
{item.status === 'AUTHORIZED' && (
|
||||||
<button
|
<button
|
||||||
className={cn(
|
className={cn(
|
||||||
styles.authorization__actionBtn,
|
styles.authorization__actionBtn,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue