WIP for not found error pages BOD-119
This commit is contained in:
@@ -19,6 +19,7 @@ import {
|
||||
} from "../../redux/application/application.actions";
|
||||
import { CreateRecentItem } from "../../utils/create-recent-item";
|
||||
import ContractDetailPageComponent from "./contract-detail.page.component";
|
||||
import NotFound from "../../components/not-found/not-found.component";
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
setBreadcrumbs: (breadcrumbs) => dispatch(setBreadcrumbs(breadcrumbs)),
|
||||
@@ -41,7 +42,11 @@ export function ContractDetailPageContainer({ setBreadcrumbs, addRecentItem }) {
|
||||
: error
|
||||
? t("titles.app")
|
||||
: t("titles.contracts-detail", {
|
||||
id: (data && data.cccontracts_by_pk.agreementnumber) || "",
|
||||
id:
|
||||
(data &&
|
||||
data.cccontracts_by_pk &&
|
||||
data.cccontracts_by_pk.agreementnumber) ||
|
||||
"",
|
||||
});
|
||||
|
||||
setBreadcrumbs([
|
||||
@@ -53,12 +58,16 @@ export function ContractDetailPageContainer({ setBreadcrumbs, addRecentItem }) {
|
||||
{
|
||||
link: "/manage/courtesycars/contracts/new",
|
||||
label: t("titles.bc.contracts-detail", {
|
||||
number: (data && data.cccontracts_by_pk.agreementnumber) || "",
|
||||
number:
|
||||
(data &&
|
||||
data.cccontracts_by_pk &&
|
||||
data.cccontracts_by_pk.agreementnumber) ||
|
||||
"",
|
||||
}),
|
||||
},
|
||||
]);
|
||||
|
||||
if (data)
|
||||
if (data && data.cccontracts_by_pk)
|
||||
addRecentItem(
|
||||
CreateRecentItem(
|
||||
contractId,
|
||||
@@ -88,12 +97,19 @@ export function ContractDetailPageContainer({ setBreadcrumbs, addRecentItem }) {
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (data) form.resetFields();
|
||||
if (data && data.cccontracts_by_pk) form.resetFields();
|
||||
}, [data, form]);
|
||||
|
||||
if (error) return <AlertComponent message={error.message} type="error" />;
|
||||
if (loading) return <LoadingSpinner />;
|
||||
|
||||
if (!!!data.cccontracts_by_pk) return <NotFound />;
|
||||
console.log(
|
||||
"data.cccontracts_by_pk",
|
||||
!!!data.cccontracts_by_pk,
|
||||
data.cccontracts_by_pk
|
||||
);
|
||||
|
||||
return (
|
||||
<RbacWrapper action="contracts:detail">
|
||||
<div>
|
||||
|
||||
Reference in New Issue
Block a user