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:
parent
2e91dc202b
commit
06961c6a24
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user