mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-28 11:36:44 +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({
|
const { isLoading, data, refetch } = useQuery({
|
||||||
queryKey: ['provider-list'],
|
queryKey: ['provider-list'],
|
||||||
queryFn: () =>
|
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(() => {
|
const availableProviders = useMemo(() => {
|
||||||
@ -356,7 +358,8 @@ function MfaSection() {
|
|||||||
queryFn: () =>
|
queryFn: () =>
|
||||||
api
|
api
|
||||||
.get(apiUrl(ApiEndpoints.auth_authenticators))
|
.get(apiUrl(ApiEndpoints.auth_authenticators))
|
||||||
.then((res) => res.data.data)
|
.then((res) => res?.data?.data ?? [])
|
||||||
|
.catch(() => [])
|
||||||
});
|
});
|
||||||
|
|
||||||
function showRecoveryCodes(codes: Recoverycodes) {
|
function showRecoveryCodes(codes: Recoverycodes) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user