feat: improve sorting logic in CertificateList by adding block scope for case statements

This commit is contained in:
Wikid82
2025-11-25 02:52:35 +00:00
parent cc6bc7d6d6
commit dea012d471

View File

@@ -31,16 +31,18 @@ export default function CertificateList() {
let comparison = 0
switch (sortColumn) {
case 'name':
case 'name': {
const aName = (a.name || a.domain || '').toLowerCase()
const bName = (b.name || b.domain || '').toLowerCase()
comparison = aName.localeCompare(bName)
break
case 'expires':
}
case 'expires': {
const aDate = new Date(a.expires_at).getTime()
const bDate = new Date(b.expires_at).getTime()
comparison = aDate - bDate
break
}
}
return sortDirection === 'asc' ? comparison : -comparison