stop refreshing homepage if unauthorized w/ burnettk
This commit is contained in:
parent
24022a73ec
commit
f2f7438640
|
@ -254,6 +254,8 @@ export default function ProcessInstanceListTable({
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
const clearRefreshRef = useRef<any>(null);
|
||||||
|
|
||||||
// eslint-disable-next-line sonarjs/cognitive-complexity
|
// eslint-disable-next-line sonarjs/cognitive-complexity
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
function setProcessInstancesFromResult(result: any) {
|
function setProcessInstancesFromResult(result: any) {
|
||||||
|
@ -268,6 +270,11 @@ export default function ProcessInstanceListTable({
|
||||||
setProcessInstanceReportSelection(result.report);
|
setProcessInstanceReportSelection(result.report);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const stopRefreshing = () => {
|
||||||
|
if (clearRefreshRef.current) {
|
||||||
|
clearRefreshRef.current();
|
||||||
|
}
|
||||||
|
};
|
||||||
function getProcessInstances() {
|
function getProcessInstances() {
|
||||||
// eslint-disable-next-line prefer-const
|
// eslint-disable-next-line prefer-const
|
||||||
let { page, perPage } = getPageInfoFromSearchParams(
|
let { page, perPage } = getPageInfoFromSearchParams(
|
||||||
|
@ -352,6 +359,7 @@ export default function ProcessInstanceListTable({
|
||||||
HttpService.makeCallToBackend({
|
HttpService.makeCallToBackend({
|
||||||
path: `${apiPath}?${queryParamString}`,
|
path: `${apiPath}?${queryParamString}`,
|
||||||
successCallback: setProcessInstancesFromResult,
|
successCallback: setProcessInstancesFromResult,
|
||||||
|
onUnauthorized: stopRefreshing,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function processResultForProcessModels(result: any) {
|
function processResultForProcessModels(result: any) {
|
||||||
|
@ -396,11 +404,12 @@ export default function ProcessInstanceListTable({
|
||||||
|
|
||||||
checkFiltersAndRun();
|
checkFiltersAndRun();
|
||||||
if (autoReload) {
|
if (autoReload) {
|
||||||
return refreshAtInterval(
|
clearRefreshRef.current = refreshAtInterval(
|
||||||
REFRESH_INTERVAL_SECONDS,
|
REFRESH_INTERVAL_SECONDS,
|
||||||
REFRESH_TIMEOUT_SECONDS,
|
REFRESH_TIMEOUT_SECONDS,
|
||||||
checkFiltersAndRun
|
checkFiltersAndRun
|
||||||
);
|
);
|
||||||
|
return clearRefreshRef.current;
|
||||||
}
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
}, [
|
}, [
|
||||||
|
|
Loading…
Reference in New Issue