Added error pages for detail type pages BOD-119
This commit is contained in:
@@ -19,9 +19,7 @@ const ResetPassword = lazy(() =>
|
||||
);
|
||||
const ManagePage = lazy(() => import("../pages/manage/manage.page.container"));
|
||||
const SignInPage = lazy(() => import("../pages/sign-in/sign-in.page"));
|
||||
const Unauthorized = lazy(() =>
|
||||
import("../pages/unauthorized/unauthorized.component")
|
||||
);
|
||||
|
||||
const CsiPage = lazy(() => import("../pages/csi/csi.container.page"));
|
||||
const MobilePaymentContainer = lazy(() =>
|
||||
import("../pages/mobile-payment/mobile-payment.container")
|
||||
@@ -51,30 +49,41 @@ export function App({ checkUserSession, currentUser }) {
|
||||
return (
|
||||
<div>
|
||||
<Switch>
|
||||
<ErrorBoundary>
|
||||
<Suspense fallback={<LoadingSpinner message="App.Js Suspense" />}>
|
||||
<ErrorBoundary>
|
||||
<Route exact path="/" component={LandingPage} />
|
||||
<Route exact path="/unauthorized" component={Unauthorized} />
|
||||
</ErrorBoundary>
|
||||
<ErrorBoundary>
|
||||
<Route exact path="/signin" component={SignInPage} />
|
||||
</ErrorBoundary>
|
||||
<ErrorBoundary>
|
||||
<Route exact path="/resetpassword" component={ResetPassword} />
|
||||
</ErrorBoundary>
|
||||
<ErrorBoundary>
|
||||
<Route exact path="/csi/:surveyId" component={CsiPage} />
|
||||
</ErrorBoundary>
|
||||
<ErrorBoundary>
|
||||
<Route
|
||||
exact
|
||||
path="/mp/:paymentIs"
|
||||
component={MobilePaymentContainer}
|
||||
/>
|
||||
</ErrorBoundary>
|
||||
<ErrorBoundary>
|
||||
<PrivateRoute
|
||||
isAuthorized={currentUser.authorized}
|
||||
path="/manage"
|
||||
component={ManagePage}
|
||||
/>
|
||||
</ErrorBoundary>
|
||||
<ErrorBoundary>
|
||||
<PrivateRoute
|
||||
isAuthorized={currentUser.authorized}
|
||||
path="/tech"
|
||||
component={TechPageContainer}
|
||||
/>
|
||||
</Suspense>
|
||||
</ErrorBoundary>
|
||||
</Suspense>
|
||||
</Switch>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
} from "../../redux/application/application.actions";
|
||||
import { CreateRecentItem } from "../../utils/create-recent-item";
|
||||
import OwnersDetailComponent from "./owners-detail.page.component";
|
||||
import NotFound from "../../components/not-found/not-found.component";
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
setBreadcrumbs: (breadcrumbs) => dispatch(setBreadcrumbs(breadcrumbs)),
|
||||
@@ -34,9 +35,9 @@ export function OwnersDetailContainer({
|
||||
useEffect(() => {
|
||||
document.title = t("titles.owners-detail", {
|
||||
name: data
|
||||
? `${data.owners_by_pk.ownr_fn || ""} ${
|
||||
data.owners_by_pk.ownr_ln || ""
|
||||
} ${data.owners_by_pk.ownr_co_nm || ""}`
|
||||
? `${(data.owners_by_pk && data.owners_by_pk.ownr_fn) || ""} ${
|
||||
(data.owners_by_pk && data.owners_by_pk.ownr_ln) || ""
|
||||
} ${(data.owners_by_pk && data.owners_by_pk.ownr_co_nm) || ""}`
|
||||
: "",
|
||||
});
|
||||
|
||||
@@ -46,15 +47,15 @@ export function OwnersDetailContainer({
|
||||
link: `/manage/owners/${ownerId}`,
|
||||
label: t("titles.bc.owner-detail", {
|
||||
name: data
|
||||
? `${data.owners_by_pk.ownr_fn || ""} ${
|
||||
data.owners_by_pk.ownr_ln || ""
|
||||
} ${data.owners_by_pk.ownr_co_nm || ""}`
|
||||
? `${(data.owners_by_pk && data.owners_by_pk.ownr_fn) || ""} ${
|
||||
(data.owners_by_pk && data.owners_by_pk.ownr_ln) || ""
|
||||
} ${(data.owners_by_pk && data.owners_by_pk.ownr_co_nm) || ""}`
|
||||
: "",
|
||||
}),
|
||||
},
|
||||
]);
|
||||
|
||||
if (data)
|
||||
if (data && data.owners_by_pk)
|
||||
addRecentItem(
|
||||
CreateRecentItem(
|
||||
ownerId,
|
||||
@@ -69,16 +70,12 @@ export function OwnersDetailContainer({
|
||||
|
||||
if (loading) return <LoadingSpinner />;
|
||||
if (error) return <AlertComponent message={error.message} type="error" />;
|
||||
if (!!!data.owners_by_pk) return <NotFound />;
|
||||
|
||||
if (data.owners_by_pk)
|
||||
return (
|
||||
<RbacWrapper action="owners:detail">
|
||||
<OwnersDetailComponent owner={data.owners_by_pk} refetch={refetch} />
|
||||
</RbacWrapper>
|
||||
);
|
||||
else
|
||||
return (
|
||||
<AlertComponent message={t("owners.errors.noaccess")} type="error" />
|
||||
);
|
||||
}
|
||||
export default connect(null, mapDispatchToProps)(OwnersDetailContainer);
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
import React from "react";
|
||||
import { Typography } from "antd";
|
||||
import HeaderContainer from "../../components/header/header.container";
|
||||
|
||||
export default function Unauthorized() {
|
||||
return (
|
||||
<div>
|
||||
<HeaderContainer landingHeader />
|
||||
<Typography.Title>Unauthorized</Typography.Title>
|
||||
<Typography.Paragraph>
|
||||
You do not have permission to view the requested page.
|
||||
</Typography.Paragraph>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
} from "../../redux/application/application.actions";
|
||||
import { connect } from "react-redux";
|
||||
import { CreateRecentItem } from "../../utils/create-recent-item";
|
||||
import NotFound from "../../components/not-found/not-found.component";
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
setBreadcrumbs: (breadcrumbs) => dispatch(setBreadcrumbs(breadcrumbs)),
|
||||
@@ -34,7 +35,9 @@ export function VehicleDetailContainer({
|
||||
document.title = t("titles.vehicledetail", {
|
||||
vehicle:
|
||||
data && data.vehicles_by_pk
|
||||
? `${data.vehicles_by_pk.v_model_yr} ${data.vehicles_by_pk.v_make_desc} ${data.vehicles_by_pk.v_model_desc}`
|
||||
? `${data.vehicles_by_pk && data.vehicles_by_pk.v_model_yr} ${
|
||||
data.vehicles_by_pk && data.vehicles_by_pk.v_make_desc
|
||||
} ${data.vehicles_by_pk && data.vehicles_by_pk.v_model_desc}`
|
||||
: "",
|
||||
});
|
||||
setBreadcrumbs([
|
||||
@@ -50,7 +53,7 @@ export function VehicleDetailContainer({
|
||||
},
|
||||
]);
|
||||
|
||||
if (data)
|
||||
if (data && data.vehicles_by_pk)
|
||||
addRecentItem(
|
||||
CreateRecentItem(
|
||||
vehId,
|
||||
@@ -64,13 +67,9 @@ export function VehicleDetailContainer({
|
||||
if (loading) return <LoadingSpinner />;
|
||||
if (error) return <AlertComponent message={error.message} type="error" />;
|
||||
|
||||
if (data.vehicles_by_pk)
|
||||
if (!!!data.vehicles_by_pk) return <NotFound />;
|
||||
return (
|
||||
<VehicleDetailComponent vehicle={data.vehicles_by_pk} refetch={refetch} />
|
||||
);
|
||||
else
|
||||
return (
|
||||
<AlertComponent message={t("vehicles.errors.noaccess")} type="error" />
|
||||
);
|
||||
}
|
||||
export default connect(null, mapDispatchToProps)(VehicleDetailContainer);
|
||||
|
||||
@@ -1,123 +0,0 @@
|
||||
{
|
||||
"parserOptions": {
|
||||
// Required for certain syntax usages
|
||||
"ecmaVersion": 2017
|
||||
},
|
||||
"plugins": [
|
||||
"promise"
|
||||
],
|
||||
"extends": "eslint:recommended",
|
||||
"rules": {
|
||||
// Removed rule "disallow the use of console" from recommended eslint rules
|
||||
"no-console": "off",
|
||||
|
||||
// Removed rule "disallow multiple spaces in regular expressions" from recommended eslint rules
|
||||
"no-regex-spaces": "off",
|
||||
|
||||
// Removed rule "disallow the use of debugger" from recommended eslint rules
|
||||
"no-debugger": "off",
|
||||
|
||||
// Removed rule "disallow unused variables" from recommended eslint rules
|
||||
"no-unused-vars": "off",
|
||||
|
||||
// Removed rule "disallow mixed spaces and tabs for indentation" from recommended eslint rules
|
||||
"no-mixed-spaces-and-tabs": "off",
|
||||
|
||||
// Removed rule "disallow the use of undeclared variables unless mentioned in /*global */ comments" from recommended eslint rules
|
||||
"no-undef": "off",
|
||||
|
||||
// Warn against template literal placeholder syntax in regular strings
|
||||
"no-template-curly-in-string": 1,
|
||||
|
||||
// Warn if return statements do not either always or never specify values
|
||||
"consistent-return": 1,
|
||||
|
||||
// Warn if no return statements in callbacks of array methods
|
||||
"array-callback-return": 1,
|
||||
|
||||
// Require the use of === and !==
|
||||
"eqeqeq": 2,
|
||||
|
||||
// Disallow the use of alert, confirm, and prompt
|
||||
"no-alert": 2,
|
||||
|
||||
// Disallow the use of arguments.caller or arguments.callee
|
||||
"no-caller": 2,
|
||||
|
||||
// Disallow null comparisons without type-checking operators
|
||||
"no-eq-null": 2,
|
||||
|
||||
// Disallow the use of eval()
|
||||
"no-eval": 2,
|
||||
|
||||
// Warn against extending native types
|
||||
"no-extend-native": 1,
|
||||
|
||||
// Warn against unnecessary calls to .bind()
|
||||
"no-extra-bind": 1,
|
||||
|
||||
// Warn against unnecessary labels
|
||||
"no-extra-label": 1,
|
||||
|
||||
// Disallow leading or trailing decimal points in numeric literals
|
||||
"no-floating-decimal": 2,
|
||||
|
||||
// Warn against shorthand type conversions
|
||||
"no-implicit-coercion": 1,
|
||||
|
||||
// Warn against function declarations and expressions inside loop statements
|
||||
"no-loop-func": 1,
|
||||
|
||||
// Disallow new operators with the Function object
|
||||
"no-new-func": 2,
|
||||
|
||||
// Warn against new operators with the String, Number, and Boolean objects
|
||||
"no-new-wrappers": 1,
|
||||
|
||||
// Disallow throwing literals as exceptions
|
||||
"no-throw-literal": 2,
|
||||
|
||||
// Require using Error objects as Promise rejection reasons
|
||||
"prefer-promise-reject-errors": 2,
|
||||
|
||||
// Enforce “for” loop update clause moving the counter in the right direction
|
||||
"for-direction": 2,
|
||||
|
||||
// Enforce return statements in getters
|
||||
"getter-return": 2,
|
||||
|
||||
// Disallow await inside of loops
|
||||
"no-await-in-loop": 2,
|
||||
|
||||
// Disallow comparing against -0
|
||||
"no-compare-neg-zero": 2,
|
||||
|
||||
// Warn against catch clause parameters from shadowing variables in the outer scope
|
||||
"no-catch-shadow": 1,
|
||||
|
||||
// Disallow identifiers from shadowing restricted names
|
||||
"no-shadow-restricted-names": 2,
|
||||
|
||||
// Enforce return statements in callbacks of array methods
|
||||
"callback-return": 2,
|
||||
|
||||
// Require error handling in callbacks
|
||||
"handle-callback-err": 2,
|
||||
|
||||
// Warn against string concatenation with __dirname and __filename
|
||||
"no-path-concat": 1,
|
||||
|
||||
// Prefer using arrow functions for callbacks
|
||||
"prefer-arrow-callback": 1,
|
||||
|
||||
// Return inside each then() to create readable and reusable Promise chains.
|
||||
// Forces developers to return console logs and http calls in promises.
|
||||
"promise/always-return": 2,
|
||||
|
||||
//Enforces the use of catch() on un-returned promises
|
||||
"promise/catch-or-return": 2,
|
||||
|
||||
// Warn against nested then() or catch() statements
|
||||
"promise/no-nesting": 1
|
||||
}
|
||||
}
|
||||
123
firebase/functions/.eslintrc.jsonx
Normal file
123
firebase/functions/.eslintrc.jsonx
Normal file
@@ -0,0 +1,123 @@
|
||||
// {
|
||||
// "parserOptions": {
|
||||
// // Required for certain syntax usages
|
||||
// "ecmaVersion": 2017
|
||||
// },
|
||||
// "plugins": [
|
||||
// "promise"
|
||||
// ],
|
||||
// "extends": "eslint:recommended",
|
||||
// "rules": {
|
||||
// // Removed rule "disallow the use of console" from recommended eslint rules
|
||||
// "no-console": "off",
|
||||
|
||||
// // Removed rule "disallow multiple spaces in regular expressions" from recommended eslint rules
|
||||
// "no-regex-spaces": "off",
|
||||
|
||||
// // Removed rule "disallow the use of debugger" from recommended eslint rules
|
||||
// "no-debugger": "off",
|
||||
|
||||
// // Removed rule "disallow unused variables" from recommended eslint rules
|
||||
// "no-unused-vars": "off",
|
||||
|
||||
// // Removed rule "disallow mixed spaces and tabs for indentation" from recommended eslint rules
|
||||
// "no-mixed-spaces-and-tabs": "off",
|
||||
|
||||
// // Removed rule "disallow the use of undeclared variables unless mentioned in /*global */ comments" from recommended eslint rules
|
||||
// "no-undef": "off",
|
||||
|
||||
// // Warn against template literal placeholder syntax in regular strings
|
||||
// "no-template-curly-in-string": 1,
|
||||
|
||||
// // Warn if return statements do not either always or never specify values
|
||||
// "consistent-return": 1,
|
||||
|
||||
// // Warn if no return statements in callbacks of array methods
|
||||
// "array-callback-return": 1,
|
||||
|
||||
// // Require the use of === and !==
|
||||
// "eqeqeq": 2,
|
||||
|
||||
// // Disallow the use of alert, confirm, and prompt
|
||||
// "no-alert": 2,
|
||||
|
||||
// // Disallow the use of arguments.caller or arguments.callee
|
||||
// "no-caller": 2,
|
||||
|
||||
// // Disallow null comparisons without type-checking operators
|
||||
// "no-eq-null": 2,
|
||||
|
||||
// // Disallow the use of eval()
|
||||
// "no-eval": 2,
|
||||
|
||||
// // Warn against extending native types
|
||||
// "no-extend-native": 1,
|
||||
|
||||
// // Warn against unnecessary calls to .bind()
|
||||
// "no-extra-bind": 1,
|
||||
|
||||
// // Warn against unnecessary labels
|
||||
// "no-extra-label": 1,
|
||||
|
||||
// // Disallow leading or trailing decimal points in numeric literals
|
||||
// "no-floating-decimal": 2,
|
||||
|
||||
// // Warn against shorthand type conversions
|
||||
// "no-implicit-coercion": 1,
|
||||
|
||||
// // Warn against function declarations and expressions inside loop statements
|
||||
// "no-loop-func": 1,
|
||||
|
||||
// // Disallow new operators with the Function object
|
||||
// "no-new-func": 2,
|
||||
|
||||
// // Warn against new operators with the String, Number, and Boolean objects
|
||||
// "no-new-wrappers": 1,
|
||||
|
||||
// // Disallow throwing literals as exceptions
|
||||
// "no-throw-literal": 2,
|
||||
|
||||
// // Require using Error objects as Promise rejection reasons
|
||||
// "prefer-promise-reject-errors": 2,
|
||||
|
||||
// // Enforce “for” loop update clause moving the counter in the right direction
|
||||
// "for-direction": 2,
|
||||
|
||||
// // Enforce return statements in getters
|
||||
// "getter-return": 2,
|
||||
|
||||
// // Disallow await inside of loops
|
||||
// "no-await-in-loop": 2,
|
||||
|
||||
// // Disallow comparing against -0
|
||||
// "no-compare-neg-zero": 2,
|
||||
|
||||
// // Warn against catch clause parameters from shadowing variables in the outer scope
|
||||
// "no-catch-shadow": 1,
|
||||
|
||||
// // Disallow identifiers from shadowing restricted names
|
||||
// "no-shadow-restricted-names": 2,
|
||||
|
||||
// // Enforce return statements in callbacks of array methods
|
||||
// "callback-return": 2,
|
||||
|
||||
// // Require error handling in callbacks
|
||||
// "handle-callback-err": 2,
|
||||
|
||||
// // Warn against string concatenation with __dirname and __filename
|
||||
// "no-path-concat": 1,
|
||||
|
||||
// // Prefer using arrow functions for callbacks
|
||||
// "prefer-arrow-callback": 1,
|
||||
|
||||
// // Return inside each then() to create readable and reusable Promise chains.
|
||||
// // Forces developers to return console logs and http calls in promises.
|
||||
// "promise/always-return": 2,
|
||||
|
||||
// //Enforces the use of catch() on un-returned promises
|
||||
// "promise/catch-or-return": 2,
|
||||
|
||||
// // Warn against nested then() or catch() statements
|
||||
// "promise/no-nesting": 1
|
||||
// }
|
||||
// }
|
||||
Reference in New Issue
Block a user