2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-28 03:26:45 +00:00

Add error handling to API queries (#9253)

This commit is contained in:
Oliver 2025-03-07 14:30:51 +11:00 committed by GitHub
parent 2e91dc202b
commit 06961c6a24
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -261,7 +261,9 @@ function ProviderSection({
const { isLoading, data, refetch } = useQuery({
queryKey: ['provider-list'],
queryFn: () =>
authApi(apiUrl(ApiEndpoints.auth_providers)).then((res) => res.data.data)
authApi(apiUrl(ApiEndpoints.auth_providers))
.then((res) => res?.data?.data ?? [])
.catch(() => [])
});
const availableProviders = useMemo(() => {
@ -356,7 +358,8 @@ function MfaSection() {
queryFn: () =>
api
.get(apiUrl(ApiEndpoints.auth_authenticators))
.then((res) => res.data.data)
.then((res) => res?.data?.data ?? [])
.catch(() => [])
});
function showRecoveryCodes(codes: Recoverycodes) {