Skip to content

Commit 8841f28

Browse files
Check ban_id before querying
1 parent 3cd86ed commit 8841f28

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

frontend/src/component/modal/BanSteamModal.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ import {
1818
BanTypeCollection,
1919
Duration,
2020
DurationCollection,
21-
schemaBanPayloadSteam
21+
schemaBanPayloadSteam,
22+
SteamBanRecord
2223
} from '../../schema/bans.ts';
2324
import { ErrorDetails } from '../ErrorDetails.tsx';
2425
import { Heading } from '../Heading';
@@ -35,7 +36,11 @@ export const BanSteamModal = NiceModal.create(({ ban_id }: { ban_id?: number })
3536
} = useQuery({
3637
queryKey: ['ban', { ban_id }],
3738
queryFn: async () => {
38-
return await apiGetBanSteam(Number(ban_id), true);
39+
if (ban_id && ban_id > 0) {
40+
return await apiGetBanSteam(Number(ban_id), true);
41+
}
42+
43+
return {} as SteamBanRecord;
3944
}
4045
});
4146

0 commit comments

Comments
 (0)