hot refactor
This commit is contained in:
parent
07afcabeb0
commit
7478164cde
|
@ -7,17 +7,9 @@ import HttpService from '../services/HttpService';
|
||||||
import ErrorContext from '../contexts/ErrorContext';
|
import ErrorContext from '../contexts/ErrorContext';
|
||||||
import { RecentProcessModel } from '../interfaces';
|
import { RecentProcessModel } from '../interfaces';
|
||||||
|
|
||||||
export default function ProcessModelShow() {
|
|
||||||
const params = useParams();
|
|
||||||
const setErrorMessage = (useContext as any)(ErrorContext)[1];
|
|
||||||
|
|
||||||
const [processModel, setProcessModel] = useState({});
|
|
||||||
const [processInstanceResult, setProcessInstanceResult] = useState(null);
|
|
||||||
const [reloadModel, setReloadModel] = useState(false);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const storeRecentProcessModelInLocalStorage = (
|
const storeRecentProcessModelInLocalStorage = (
|
||||||
processModelForStorage: any
|
processModelForStorage: any,
|
||||||
|
params: any
|
||||||
) => {
|
) => {
|
||||||
if (
|
if (
|
||||||
params.process_group_id === undefined ||
|
params.process_group_id === undefined ||
|
||||||
|
@ -65,17 +57,23 @@ export default function ProcessModelShow() {
|
||||||
const stringRepresentingArray = JSON.stringify(array);
|
const stringRepresentingArray = JSON.stringify(array);
|
||||||
|
|
||||||
// and store it in localStorage as "recentProcessModels"
|
// and store it in localStorage as "recentProcessModels"
|
||||||
window.localStorage.setItem(
|
window.localStorage.setItem('recentProcessModels', stringRepresentingArray);
|
||||||
'recentProcessModels',
|
|
||||||
stringRepresentingArray
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export default function ProcessModelShow() {
|
||||||
|
const params = useParams();
|
||||||
|
const setErrorMessage = (useContext as any)(ErrorContext)[1];
|
||||||
|
|
||||||
|
const [processModel, setProcessModel] = useState({});
|
||||||
|
const [processInstanceResult, setProcessInstanceResult] = useState(null);
|
||||||
|
const [reloadModel, setReloadModel] = useState(false);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
const processResult = (result: object) => {
|
const processResult = (result: object) => {
|
||||||
setProcessModel(result);
|
setProcessModel(result);
|
||||||
setReloadModel(false);
|
setReloadModel(false);
|
||||||
storeRecentProcessModelInLocalStorage(result);
|
storeRecentProcessModelInLocalStorage(result, params);
|
||||||
};
|
};
|
||||||
HttpService.makeCallToBackend({
|
HttpService.makeCallToBackend({
|
||||||
path: `/process-models/${params.process_group_id}/${params.process_model_id}`,
|
path: `/process-models/${params.process_group_id}/${params.process_model_id}`,
|
||||||
|
|
Loading…
Reference in New Issue