Skip to content

Commit eb9a6cd

Browse files
committed
fix: ensure consistent access to admins data in user-sub-update pie chart and set-owner modal
1 parent 26ac408 commit eb9a6cd

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

dashboard/src/components/charts/user-sub-update-pie-chart.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,8 @@ function UserSubUpdatePieChart({ username, adminId }: UserSubUpdatePieChartProps
245245
</SelectTrigger>
246246
<SelectContent>
247247
<SelectItem value="all">{t('statistics.adminFilterAll')}</SelectItem>
248-
{admins
249-
?.filter(admin => admin.id != null)
248+
{(admins?.admins || [])
249+
.filter(admin => admin.id != null)
250250
.map(admin => (
251251
<SelectItem key={admin.id} value={String(admin.id)}>
252252
{admin.username}

dashboard/src/components/dialogs/set-owner-modal.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ export default function SetOwnerModal({ open, onClose, username, currentOwner, o
4646
import('@/service/api').then(api => {
4747
api
4848
.getAdmins()
49-
.then(admins => {
50-
setAdmins(admins)
49+
.then(adminsResponse => {
50+
setAdmins(adminsResponse?.admins || [])
5151
setIsLoading(false)
5252
})
5353
.catch(() => {

0 commit comments

Comments
 (0)