now it can't be called without an error handler (#389)
This commit is contained in:
parent
f71006b717
commit
d25ba0af2b
4 changed files with 15 additions and 6 deletions
|
@ -1,4 +1,5 @@
|
||||||
import React, { useState, useEffect, ReactElement, useContext } from "react";
|
import React, { useState, useEffect, ReactElement, useContext } from "react";
|
||||||
|
import { useErrorHandler } from "react-error-boundary";
|
||||||
import {
|
import {
|
||||||
Alert,
|
Alert,
|
||||||
AlertVariant,
|
AlertVariant,
|
||||||
|
@ -56,6 +57,7 @@ export const DownloadDialog = ({
|
||||||
protocol = "openid-connect",
|
protocol = "openid-connect",
|
||||||
}: DownloadDialogModalProps) => {
|
}: DownloadDialogModalProps) => {
|
||||||
const adminClient = useAdminClient();
|
const adminClient = useAdminClient();
|
||||||
|
const handleError = useErrorHandler();
|
||||||
const { t } = useTranslation("common");
|
const { t } = useTranslation("common");
|
||||||
const { enabled } = useContext(HelpContext);
|
const { enabled } = useContext(HelpContext);
|
||||||
const serverInfo = useServerInfo();
|
const serverInfo = useServerInfo();
|
||||||
|
@ -80,7 +82,8 @@ export const DownloadDialog = ({
|
||||||
return JSON.stringify(snippet, undefined, 3);
|
return JSON.stringify(snippet, undefined, 3);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
(snippet) => setSnippet(snippet)
|
(snippet) => setSnippet(snippet),
|
||||||
|
handleError
|
||||||
);
|
);
|
||||||
}, [selected]);
|
}, [selected]);
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -37,7 +37,7 @@ export const useAdminClient = () => {
|
||||||
export function asyncStateFetch<T>(
|
export function asyncStateFetch<T>(
|
||||||
adminClientCall: () => Promise<T>,
|
adminClientCall: () => Promise<T>,
|
||||||
callback: (param: T) => void,
|
callback: (param: T) => void,
|
||||||
onError?: (error: Error) => void
|
onError: (error: Error) => void
|
||||||
) {
|
) {
|
||||||
let canceled = false;
|
let canceled = false;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
import React, { useContext, useEffect, useState } from "react";
|
import React, { useContext, useEffect, useState } from "react";
|
||||||
|
import { useHistory, useRouteMatch } from "react-router-dom";
|
||||||
|
import { useErrorHandler } from "react-error-boundary";
|
||||||
import {
|
import {
|
||||||
AlertVariant,
|
AlertVariant,
|
||||||
ButtonVariant,
|
ButtonVariant,
|
||||||
|
@ -24,9 +26,8 @@ import { useTranslation } from "react-i18next";
|
||||||
import { RealmContext } from "../context/realm-context/RealmContext";
|
import { RealmContext } from "../context/realm-context/RealmContext";
|
||||||
import { useAdminClient, asyncStateFetch } from "../context/auth/AdminClient";
|
import { useAdminClient, asyncStateFetch } from "../context/auth/AdminClient";
|
||||||
import { useConfirmDialog } from "../components/confirm-dialog/ConfirmDialog";
|
import { useConfirmDialog } from "../components/confirm-dialog/ConfirmDialog";
|
||||||
import "./user-federation.css";
|
|
||||||
|
|
||||||
import { useHistory, useRouteMatch } from "react-router-dom";
|
import "./user-federation.css";
|
||||||
|
|
||||||
export const UserFederationSection = () => {
|
export const UserFederationSection = () => {
|
||||||
const [userFederations, setUserFederations] = useState<
|
const [userFederations, setUserFederations] = useState<
|
||||||
|
@ -39,6 +40,7 @@ export const UserFederationSection = () => {
|
||||||
const [key, setKey] = useState(0);
|
const [key, setKey] = useState(0);
|
||||||
const refresh = () => setKey(new Date().getTime());
|
const refresh = () => setKey(new Date().getTime());
|
||||||
|
|
||||||
|
const handleError = useErrorHandler();
|
||||||
const { url } = useRouteMatch();
|
const { url } = useRouteMatch();
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
|
|
||||||
|
@ -53,7 +55,8 @@ export const UserFederationSection = () => {
|
||||||
},
|
},
|
||||||
(userFederations) => {
|
(userFederations) => {
|
||||||
setUserFederations(userFederations);
|
setUserFederations(userFederations);
|
||||||
}
|
},
|
||||||
|
handleError
|
||||||
);
|
);
|
||||||
}, [key]);
|
}, [key]);
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import React, { useContext, useEffect, useState } from "react";
|
import React, { useContext, useEffect, useState } from "react";
|
||||||
|
import { useErrorHandler } from "react-error-boundary";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import {
|
import {
|
||||||
AlertVariant,
|
AlertVariant,
|
||||||
|
@ -34,6 +35,7 @@ type BruteUser = UserRepresentation & {
|
||||||
|
|
||||||
export const UsersSection = () => {
|
export const UsersSection = () => {
|
||||||
const { t } = useTranslation("users");
|
const { t } = useTranslation("users");
|
||||||
|
const handleError = useErrorHandler();
|
||||||
const adminClient = useAdminClient();
|
const adminClient = useAdminClient();
|
||||||
const { addAlert } = useAlerts();
|
const { addAlert } = useAlerts();
|
||||||
const { realm: realmName } = useContext(RealmContext);
|
const { realm: realmName } = useContext(RealmContext);
|
||||||
|
@ -61,7 +63,8 @@ export const UsersSection = () => {
|
||||||
setListUsers(
|
setListUsers(
|
||||||
!((response[0] && response[0].length > 0) || response[1] > 100)
|
!((response[0] && response[0].length > 0) || response[1] > 100)
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
|
handleError
|
||||||
);
|
);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue