From cb4d16331dd550e67db103c5d3c4823ad4c555ff Mon Sep 17 00:00:00 2001
From: SakthivelG <sakthivel.govindan@tarento.com>
Date: Wed, 23 Mar 2022 16:26:10 +0530
Subject: [PATCH] fix: numeric field issue

---
 src/components/form/fields/Input.js           |  15 +-
 src/components/modal/ModalTwo.tsx             |   3 +-
 src/layouts/Inspector/ConsentFormView.tsx     |  93 ++++++++-
 src/layouts/Inspector/FormView.tsx            | 160 ++++++++++++++++
 .../Regulator/ReviewApplicationLayout.tsx     | 178 ++++++++++++++----
 src/pages/Reviewer/ReviewerHome.tsx           |   2 +-
 src/services/form.service.js                  |  79 ++++----
 src/services/review.service.js                |  32 ++--
 8 files changed, 462 insertions(+), 100 deletions(-)

diff --git a/src/components/form/fields/Input.js b/src/components/form/fields/Input.js
index e1c6a62..d7af090 100644
--- a/src/components/form/fields/Input.js
+++ b/src/components/form/fields/Input.js
@@ -51,6 +51,18 @@ class Input extends Component {
     }
   };
 
+  componentDidUpdate() {
+    if (this.props.field.fieldType === LANG.FIELD_TYPES.numeric.toLowerCase()) {
+      setTimeout(() => {
+        let numericField = document.getElementById(
+          `field-${this.props.field.order}`
+        );
+
+        numericField.type = "number";
+      }, 250);
+    }
+  }
+
   render() {
     // console.log(this.props.field.fieldType);
     // strings.setLanguage(
@@ -76,7 +88,8 @@ class Input extends Component {
             LANG.FIELD_TYPES.email.toLowerCase() && (
             <input
               type={
-                this.props.field.fieldType === LANG.FIELD_TYPES.numeric
+                this.props.field.fieldType ===
+                LANG.FIELD_TYPES.numeric.toLowerCase()
                   ? "number"
                   : this.state.fieldType
               }
diff --git a/src/components/modal/ModalTwo.tsx b/src/components/modal/ModalTwo.tsx
index 31c1643..cb75859 100644
--- a/src/components/modal/ModalTwo.tsx
+++ b/src/components/modal/ModalTwo.tsx
@@ -152,6 +152,7 @@ export const ModalTwo = ({
               </div>
             )}
           </div>
+          
           <div
             className={`${styles.custom_modal_footer} modal-footer p-0 m-0 pt-3 pb-3`}
           >
@@ -213,7 +214,7 @@ export const ModalTwo = ({
                   ) : (
                     <button
                       type="button"
-                      className={`${btnStyleTwo.btn_two}`}
+                      className={`${btnStyleTwo.btn_two_disabled}`}
                       disabled={true}
                     >
                       Submit
diff --git a/src/layouts/Inspector/ConsentFormView.tsx b/src/layouts/Inspector/ConsentFormView.tsx
index 471d141..2b4bed8 100644
--- a/src/layouts/Inspector/ConsentFormView.tsx
+++ b/src/layouts/Inspector/ConsentFormView.tsx
@@ -715,7 +715,9 @@ export const ConsentFormView = ({
                                                     k.lastName[0]}
                                                 </div>
                                                 <p className="ps-2">
-                                                  {k.firstName + " " + k.lastName}
+                                                  {k.firstName +
+                                                    " " +
+                                                    k.lastName}
                                                 </p>
                                               </div>
                                             </div>
@@ -753,7 +755,9 @@ export const ConsentFormView = ({
                                                     k.lastName[0]}
                                                 </div>
                                                 <p className="ps-2">
-                                                  {k.firstName + " " + k.lastName}
+                                                  {k.firstName +
+                                                    " " +
+                                                    k.lastName}
                                                 </p>
                                               </div>
                                               {k.status && (
@@ -847,6 +851,91 @@ export const ConsentFormView = ({
                                     />
                                   </div>
 
+                                  <div className="mt-3">
+                                    <InspectCheckOne
+                                      label="Is the given information found correct?"
+                                      inspectionValue={k.inspectionValue}
+                                      disableEdit={true}
+                                      children={
+                                        <div className="d-flex flex-row">
+                                          {k.isCorrect === "" ? (
+                                            <>
+                                              <div className="me-3">
+                                                <Radio
+                                                  isSelected={false}
+                                                  label="Correct"
+                                                />
+                                              </div>
+                                              <div className="me-3">
+                                                <Radio
+                                                  isSelected={false}
+                                                  label="Incorrect"
+                                                  isModal={false}
+                                                />
+                                              </div>
+                                            </>
+                                          ) : k.isCorrect === true ? (
+                                            <>
+                                              <div className="me-3">
+                                                <Radio
+                                                  isSelected={true}
+                                                  label="Correct"
+                                                />
+                                              </div>
+                                              <div className="me-3">
+                                                <Radio
+                                                  isSelected={false}
+                                                  label="Incorrect"
+                                                  isModal={false}
+                                                />
+                                              </div>
+                                            </>
+                                          ) : (
+                                            <>
+                                              <div className="me-3">
+                                                <Radio
+                                                  isSelected={false}
+                                                  label="Correct"
+                                                />
+                                              </div>
+                                              <div className="me-3">
+                                                <Radio
+                                                  isSelected={true}
+                                                  label="Incorrect"
+                                                  isModal={false}
+                                                />
+                                              </div>
+                                            </>
+                                          )}
+                                        </div>
+                                      }
+                                      showComments={
+                                        k.comments !== "" ? true : false
+                                      }
+                                      comments={k.comments}
+                                    />
+                                  </div>
+                                </>
+                              }
+                            />
+                          </div>
+                        );
+                      case "email":
+                        return (
+                          <div className="mt-3" key={l}>
+                            <CardThree
+                              children={
+                                <>
+                                  <div className="ps-4 pe-4 pt-3 col-4">
+                                    <TextField
+                                      showLabel={k.label ? true : false}
+                                      label={k.label || ""}
+                                      type="email"
+                                      isReadOnly={true}
+                                      value={k.value || ""}
+                                    />
+                                  </div>
+
                                   <div className="mt-3">
                                     <InspectCheckOne
                                       label="Is the given information found correct?"
diff --git a/src/layouts/Inspector/FormView.tsx b/src/layouts/Inspector/FormView.tsx
index 9e7d502..38cedb8 100644
--- a/src/layouts/Inspector/FormView.tsx
+++ b/src/layouts/Inspector/FormView.tsx
@@ -610,6 +610,166 @@ export const FormView = ({ applicationData, formData }: FormViewProps) => {
                             />
                           </div>
                         );
+                      case "email":
+                        return (
+                          <div className="mt-3" key={l}>
+                            <CardThree
+                              children={
+                                <>
+                                  <div className="ps-4 pe-4 pt-3 col-4">
+                                    <TextField
+                                      showLabel={k.label ? true : false}
+                                      label={k.label || ""}
+                                      type="email"
+                                      isReadOnly={true}
+                                      value={k.value || ""}
+                                    />
+                                  </div>
+                                  <div className="mt-3">
+                                    <InspectCheckOne
+                                      label="Is the given information found correct?"
+                                      modalTriggerLabel={"Edit"}
+                                      disableEdit={false}
+                                      clickHandler={(e) => {
+                                        setModalTextArea(k.comments);
+                                        setModalInspectionValue(
+                                          k.inspectionValue
+                                        );
+                                      }}
+                                      inspectionValue={k.inspectionValue}
+                                      children={
+                                        <div className="d-flex flex-row">
+                                          {k.isCorrect === "" ? (
+                                            <>
+                                              <div className="me-3">
+                                                <Radio
+                                                  isSelected={false}
+                                                  label="Correct"
+                                                  clickHandler={(e) => {
+                                                    onCheckCorrectness(
+                                                      e,
+                                                      selectedMenuLabel,
+                                                      k.label,
+                                                      "correct"
+                                                    );
+                                                  }}
+                                                />
+                                              </div>
+                                              <div className="me-3">
+                                                <Radio
+                                                  isSelected={false}
+                                                  label="Incorrect"
+                                                  isModal={true}
+                                                  modalId={
+                                                    k.label
+                                                      .replace(/\s/g, "")
+                                                      .replace(
+                                                        /[^a-zA-Z ]/g,
+                                                        ""
+                                                      ) + k.id
+                                                  }
+                                                  clickHandler={(e) => {
+                                                    onCheckCorrectness(
+                                                      e,
+                                                      selectedMenuLabel,
+                                                      k.label,
+                                                      "incorrect"
+                                                    );
+                                                  }}
+                                                />
+                                              </div>
+                                            </>
+                                          ) : k.isCorrect === true ? (
+                                            <>
+                                              <div className="me-3">
+                                                <Radio
+                                                  isSelected={true}
+                                                  label="Correct"
+                                                />
+                                              </div>
+                                              <div className="me-3">
+                                                <Radio
+                                                  isSelected={false}
+                                                  label="Incorrect"
+                                                  isModal={true}
+                                                  modalId={
+                                                    k.label
+                                                      .replace(/\s/g, "")
+                                                      .replace(
+                                                        /[^a-zA-Z ]/g,
+                                                        ""
+                                                      ) + k.id
+                                                  }
+                                                  clickHandler={(e) => {
+                                                    onCheckCorrectness(
+                                                      e,
+                                                      selectedMenuLabel,
+                                                      k.label,
+                                                      "incorrect"
+                                                    );
+                                                  }}
+                                                />
+                                              </div>
+                                            </>
+                                          ) : (
+                                            <>
+                                              <div className="me-3">
+                                                <Radio
+                                                  isSelected={false}
+                                                  label="Correct"
+                                                  clickHandler={(e) => {
+                                                    onCheckCorrectness(
+                                                      e,
+                                                      selectedMenuLabel,
+                                                      k.label,
+                                                      "correct"
+                                                    );
+                                                  }}
+                                                />
+                                              </div>
+                                              <div className="me-3">
+                                                <Radio
+                                                  isSelected={true}
+                                                  label="Incorrect"
+                                                  isModal={true}
+                                                  modalId={
+                                                    k.label
+                                                      .replace(/\s/g, "")
+                                                      .replace(
+                                                        /[^a-zA-Z ]/g,
+                                                        ""
+                                                      ) + k.id
+                                                  }
+                                                  clickHandler={(e) => {
+                                                    onCheckCorrectness(
+                                                      e,
+                                                      selectedMenuLabel,
+                                                      k.label,
+                                                      "incorrect"
+                                                    );
+                                                  }}
+                                                />
+                                              </div>
+                                            </>
+                                          )}
+                                        </div>
+                                      }
+                                      showComments={
+                                        k.comments !== "" ? true : false
+                                      }
+                                      comments={k.comments}
+                                      modalId={
+                                        k.label
+                                          .replace(/\s/g, "")
+                                          .replace(/[^a-zA-Z ]/g, "") + k.id
+                                      }
+                                    />
+                                  </div>
+                                </>
+                              }
+                            />
+                          </div>
+                        );
                       case "date":
                         return (
                           <div className="mt-3" key={l}>
diff --git a/src/layouts/Regulator/ReviewApplicationLayout.tsx b/src/layouts/Regulator/ReviewApplicationLayout.tsx
index 2cc68df..291e2d7 100644
--- a/src/layouts/Regulator/ReviewApplicationLayout.tsx
+++ b/src/layouts/Regulator/ReviewApplicationLayout.tsx
@@ -276,40 +276,6 @@ export const ReviewApplicationLayout = ({
     }
   }, [selectedMenuLabel, processedData]);
 
-  useEffect(() => {
-    if (reviewerNote[0] !== "") {
-      let payload = {};
-
-      if (reviewerNote[0] === "Empty!") {
-        payload = {
-          applicationId: applicationData.applicationId,
-        };
-      } else {
-        payload = {
-          applicationId: applicationData.applicationId,
-          notes: reviewerNote[0],
-        };
-      }
-
-      ReviewService.returnApplication(payload).then(
-        (response) => {
-          if (response.statusInfo.statusCode === APP.CODE.SUCCESS) {
-            Notify.success("Application returned to institute");
-          } else {
-            Notify.error(response.statusInfo.errorMessage);
-          }
-        },
-        (error) => {
-          error.statusInfo
-            ? Notify.error(error.statusInfo.errorMessage)
-            : Notify.error(error.message);
-        }
-      );
-      history.push(APP.ROUTES.DASHBOARD);
-    }
-    // eslint-disable-next-line react-hooks/exhaustive-deps
-  }, [reviewerNote]);
-
   const getApplicationStatusLog = (id: any) => {
     ReviewService.getStatusLog(id).then(
       (response) => {
@@ -368,6 +334,40 @@ export const ReviewApplicationLayout = ({
     }
   };
 
+  const returnApplication = (e: any) => {
+    e.preventDefault();
+
+    let textAreaElement = document.getElementById("returnModal");
+    let comments = textAreaElement?.querySelector("textarea")?.value;
+
+    if (comments !== "" && comments && comments?.length > 5) {
+      let payload = {};
+
+      payload = {
+        applicationId: applicationData.applicationId,
+        notes: comments,
+      };
+
+      ReviewService.returnApplication(payload).then(
+        (response) => {
+          if (response.statusInfo.statusCode === APP.CODE.SUCCESS) {
+            Notify.success("Application returned to institute");
+          } else {
+            Notify.error(response.statusInfo.errorMessage);
+          }
+        },
+        (error) => {
+          error.statusInfo
+            ? Notify.error(error.statusInfo.errorMessage)
+            : Notify.error(error.message);
+        }
+      );
+      history.push(APP.ROUTES.DASHBOARD);
+    } else {
+      Notify.error("Kindly enter proper review comments!");
+    }
+  };
+
   return (
     <div className="">
       {applicationData && (
@@ -480,18 +480,21 @@ export const ReviewApplicationLayout = ({
                 </div>
                 <ModalTwo
                   id="returnModal"
-                  enableHandler={false}
+                  enableHandler={true}
                   enableSkip={false}
                   ariaLabel="returnModalLabel"
                   showTextAreaLabel={false}
                   heading="Add note"
                   textAreaPlaceholder="Write here"
+                  submitHandler={(e: any) => {
+                    returnApplication(e);
+                  }}
                 />
                 <ModalTwo
                   id="rejectModal"
-                  enableHandler={true}
+                  enableHandler={false}
                   enableSkip={false}
-                  ariaLabel="returnModalLabel"
+                  ariaLabel="rejectModalLabel"
                   showTextAreaLabel={false}
                   heading="Add note"
                   textAreaPlaceholder="Write here"
@@ -503,7 +506,7 @@ export const ReviewApplicationLayout = ({
                   id="approveModal"
                   enableHandler={true}
                   enableSkip={false}
-                  ariaLabel="returnModalLabel"
+                  ariaLabel="approveModalLabel"
                   showTextAreaLabel={false}
                   heading="Add note"
                   textAreaPlaceholder="Write here"
@@ -639,7 +642,9 @@ export const ReviewApplicationLayout = ({
                                                     k.lastName[0]}
                                                 </div>
                                                 <p className="ps-2">
-                                                  {k.firstName + " " + k.lastName}
+                                                  {k.firstName +
+                                                    " " +
+                                                    k.lastName}
                                                 </p>
                                               </div>
                                             </div>
@@ -678,7 +683,9 @@ export const ReviewApplicationLayout = ({
                                                       k.lastName[0]}
                                                   </div>
                                                   <p className="ps-2">
-                                                    {k.firstName + " " + k.lastName}
+                                                    {k.firstName +
+                                                      " " +
+                                                      k.lastName}
                                                   </p>
                                                 </div>
 
@@ -846,6 +853,97 @@ export const ReviewApplicationLayout = ({
                             />
                           </div>
                         );
+                      case "email":
+                        return (
+                          <div className="mt-3" key={l}>
+                            <CardThree
+                              children={
+                                <>
+                                  <div className="ps-4 pe-4 pt-3 col-4">
+                                    <TextField
+                                      showLabel={k.label ? true : false}
+                                      label={k.label || ""}
+                                      type="email"
+                                      isReadOnly={true}
+                                      value={k.value || ""}
+                                    />
+                                  </div>
+                                  {(applicationData.status ===
+                                    LANG.FORM_STATUS.INSPECTION_COMPLETED ||
+                                    applicationData.status ===
+                                      LANG.FORM_STATUS.APPROVED ||
+                                    applicationData.status ===
+                                      LANG.FORM_STATUS.REJECTED) && (
+                                    <div className="mt-3">
+                                      <InspectCheckOne
+                                        label="Is the given information found correct?"
+                                        inspectionValue={k.inspectionValue}
+                                        disableEdit={true}
+                                        children={
+                                          <div className="d-flex flex-row">
+                                            {k.isCorrect === "" ? (
+                                              <>
+                                                <div className="me-3">
+                                                  <Radio
+                                                    isSelected={false}
+                                                    label="Correct"
+                                                  />
+                                                </div>
+                                                <div className="me-3">
+                                                  <Radio
+                                                    isSelected={false}
+                                                    label="Incorrect"
+                                                    isModal={false}
+                                                  />
+                                                </div>
+                                              </>
+                                            ) : k.isCorrect === true ? (
+                                              <>
+                                                <div className="me-3">
+                                                  <Radio
+                                                    isSelected={true}
+                                                    label="Correct"
+                                                  />
+                                                </div>
+                                                <div className="me-3">
+                                                  <Radio
+                                                    isSelected={false}
+                                                    label="Incorrect"
+                                                    isModal={false}
+                                                  />
+                                                </div>
+                                              </>
+                                            ) : (
+                                              <>
+                                                <div className="me-3">
+                                                  <Radio
+                                                    isSelected={false}
+                                                    label="Correct"
+                                                  />
+                                                </div>
+                                                <div className="me-3">
+                                                  <Radio
+                                                    isSelected={true}
+                                                    label="Incorrect"
+                                                    isModal={false}
+                                                  />
+                                                </div>
+                                              </>
+                                            )}
+                                          </div>
+                                        }
+                                        showComments={
+                                          k.comments !== "" ? true : false
+                                        }
+                                        comments={k.comments}
+                                      />
+                                    </div>
+                                  )}
+                                </>
+                              }
+                            />
+                          </div>
+                        );
                       case "date":
                         return (
                           <div className="mt-3" key={l}>
diff --git a/src/pages/Reviewer/ReviewerHome.tsx b/src/pages/Reviewer/ReviewerHome.tsx
index 7a0235b..1d77d7b 100644
--- a/src/pages/Reviewer/ReviewerHome.tsx
+++ b/src/pages/Reviewer/ReviewerHome.tsx
@@ -62,7 +62,7 @@ export const ReviewerHome = ({ data }: ReviewerProps) => {
       FormService.getAllApplications(myApplicationsReq).then(
         (response2) => {
           if (response2.statusInfo.statusCode === APP.CODE.SUCCESS) {
-            let data = response2.responseData.reverse();
+            let data = response2.responseData;
 
             let tempArray: any = [];
 
diff --git a/src/services/form.service.js b/src/services/form.service.js
index 1f1f9d5..b0e1ae7 100644
--- a/src/services/form.service.js
+++ b/src/services/form.service.js
@@ -14,154 +14,155 @@ export const FormService = {
   getMyApplications,
   findApplication,
   uploadfile,
-  getApplicationsStatusCount
+  getApplicationsStatusCount,
 };
 
-function get() {
+async function get() {
   const requestOptions = {
     method: APP.REQUEST.GET,
     headers: authHeader(),
   };
-  return fetch(APIS.BASE_URL + APIS.FORM.GET, requestOptions).then(
+  return await fetch(APIS.BASE_URL + APIS.FORM.GET, requestOptions).then(
     handleResponse
   );
 }
 
-function find(formId) {
+async function find(formId) {
   const requestOptions = {
     method: APP.REQUEST.GET,
     headers: authHeader(),
   };
-  return fetch(APIS.BASE_URL + APIS.FORM.FIND + formId, requestOptions).then(
+  return await fetch(APIS.BASE_URL + APIS.FORM.FIND + formId, requestOptions).then(
     handleResponse
   );
 }
 
-function add(form) {
+async function add(form) {
   const requestOptions = {
     method: APP.REQUEST.POST,
     body: JSON.stringify(form),
     headers: authHeader(),
   };
-  return fetch(APIS.BASE_URL + APIS.FORM.ADD, requestOptions).then(
+  return await fetch(APIS.BASE_URL + APIS.FORM.ADD, requestOptions).then(
     handleResponse
   );
 }
 
-function update(form) {
+async function update(form) {
   const requestOptions = {
     method: APP.REQUEST.POST,
     body: JSON.stringify(form),
     headers: authHeader(),
   };
-  return fetch(APIS.BASE_URL + APIS.FORM.UPDATE, requestOptions).then(
+  return await fetch(APIS.BASE_URL + APIS.FORM.UPDATE, requestOptions).then(
     handleResponse
   );
 }
 
-function remove(form) {
+async function remove(form) {
   const requestOptions = {
     method: APP.REQUEST.POST,
     body: JSON.stringify(form),
     headers: authHeader(),
   };
-  return fetch(APIS.BASE_URL + APIS.FORM.DELETE, requestOptions).then(
+  return await fetch(APIS.BASE_URL + APIS.FORM.DELETE, requestOptions).then(
     handleResponse
   );
 }
 
-function submit(form) {
+async function submit(form) {
   const requestOptions = {
     method: APP.REQUEST.POST,
     body: JSON.stringify(form),
     headers: authHeader(),
   };
-  return fetch(APIS.BASE_URL + APIS.FORM.SUBMIT, requestOptions).then(
+  return await fetch(APIS.BASE_URL + APIS.FORM.SUBMIT, requestOptions).then(
     handleResponse
   );
 }
 
-function getAllApplications(req) {
+async function getAllApplications(req) {
   const requestOptions = {
     method: APP.REQUEST.POST,
     headers: authHeader(),
-    body: JSON.stringify(req)
+    body: JSON.stringify(req),
   };
-  return fetch(
+  return await fetch(
     APIS.BASE_URL + APIS.FORM.GET_ALL_APPLICATIONS,
     requestOptions
   ).then(handleResponse);
 }
 
-function getMyApplications(req) {
+async function getMyApplications(req) {
   const requestOptions = {
     method: APP.REQUEST.POST,
     headers: authHeader(),
-    body: JSON.stringify(req)
+    body: JSON.stringify(req),
   };
-  return fetch(
+  return await fetch(
     APIS.BASE_URL + APIS.FORM.GET_ALL_APPLICATIONS + "?myApplication=true'",
     requestOptions
   ).then(handleResponse);
 }
 
-function getApplicationsStatusCount() {
+async function getApplicationsStatusCount() {
   const requestOptions = {
     method: APP.REQUEST.GET,
     headers: authHeader(),
   };
-  return fetch(
+  return await fetch(
     APIS.BASE_URL + APIS.FORM.GET__APPLICATIONS_STATUS_COUNT,
     requestOptions
   ).then(handleResponse);
 }
 
-function findApplication(applicationId) {
+async function findApplication(applicationId) {
   const requestOptions = {
     method: APP.REQUEST.GET,
     headers: authHeader(),
   };
-  return fetch(
+  return await fetch(
     APIS.BASE_URL + APIS.FORM.GET_APPLICATION_DETAILS + applicationId,
     requestOptions
   ).then(handleResponse);
 }
 
-function uploadfile(form) {
+async function uploadfile(form) {
   const requestOptions = {
     method: APP.REQUEST.POST,
     body: form,
     headers: {
-        ...authHeaderForUpload(),
-        // 'Accept': 'application/json',
-        // 'Content-Type': 'multipart/form-data'
+      ...authHeaderForUpload(),
+      // 'Accept': 'application/json',
+      // 'Content-Type': 'multipart/form-data'
     },
   };
-  return fetch(APIS.BASE_URL  + APIS.FORM.FILE_UPLOAD,
-    requestOptions,
-  ).then(handleResponse);
+  return await fetch(APIS.BASE_URL + APIS.FORM.FILE_UPLOAD, requestOptions).then(
+    handleResponse
+  );
 }
 
 function handleResponse(response) {
-  
   return response.text().then((text) => {
     const data = text && JSON.parse(text);
     if (!response.ok) {
       const error =
-        LANG.APIERROR || (data && data.statusInfo && data.statusInfo.errorMessage) || response.statusText;
+        LANG.APIERROR ||
+        (data && data.statusInfo && data.statusInfo.errorMessage) ||
+        response.statusText;
       return Promise.reject(new Error(error));
     }
-    if(data && data.statusInfo && data.statusInfo.statusCode) {
-      if(data.statusInfo.statusCode === 306) {
+    if (data && data.statusInfo && data.statusInfo.statusCode) {
+      if (data.statusInfo.statusCode === 306) {
         const error =
-        (data && data.statusInfo && data.statusInfo.errorMessage) || response.statusText;
-        UserService.logout()
-        Notify.error(error.message)
-        window.location.reload()
+          (data && data.statusInfo && data.statusInfo.errorMessage) ||
+          response.statusText;
+        UserService.logout();
+        Notify.error(error.message);
+        window.location.reload();
         return Promise.reject(new Error(error));
       }
     }
     return data;
   });
 }
-
diff --git a/src/services/review.service.js b/src/services/review.service.js
index 4934cab..1f1ea5f 100644
--- a/src/services/review.service.js
+++ b/src/services/review.service.js
@@ -14,31 +14,31 @@ export const ReviewService = {
   consentApplication,
 };
 
-function returnApplication(payload) {
+async function returnApplication(payload) {
   const requestOptions = {
     method: APP.REQUEST.POST,
     body: JSON.stringify(payload),
     headers: authHeader(),
   };
-  return fetch(
+  return await fetch(
     APIS.BASE_URL + APIS.REGULATOR.RETURN_APPLICATION,
     requestOptions
   ).then(handleResponse);
 }
 
-function assignToInspection(payload) {
+async function assignToInspection(payload) {
   const requestOptions = {
     method: APP.REQUEST.POST,
     body: JSON.stringify(payload),
     headers: authHeader(),
   };
-  return fetch(
+  return await fetch(
     APIS.BASE_URL + APIS.REGULATOR.ASSIGN_TO_INSPECTION,
     requestOptions
   ).then(handleResponse);
 }
 
-function getAllInspectors() {
+async function getAllInspectors() {
   const requestOptions = {
     method: APP.REQUEST.POST,
     body: JSON.stringify({
@@ -47,65 +47,65 @@ function getAllInspectors() {
     }),
     headers: authHeader(),
   };
-  return fetch(APIS.BASE_URL + APIS.USER.GET_ALL_USERS, requestOptions).then(
+  return await fetch(APIS.BASE_URL + APIS.USER.GET_ALL_USERS, requestOptions).then(
     handleResponse
   );
 }
 
-function getStatusLog(applicationId) {
+async function getStatusLog(applicationId) {
   const requestOptions = {
     method: APP.REQUEST.GET,
     headers: authHeader(),
   };
-  return fetch(
+  return await fetch(
     APIS.BASE_URL + APIS.REGULATOR.GET_STATUS_LOG + applicationId,
     requestOptions
   ).then(handleResponse);
 }
 
-function submitInspectionDetails(payload) {
+async function submitInspectionDetails(payload) {
   const requestOptions = {
     method: APP.REQUEST.POST,
     body: JSON.stringify(payload),
     headers: authHeader(),
   };
-  return fetch(
+  return await fetch(
     APIS.BASE_URL + APIS.INSPECTOR.SUBMIT_INSPECTION_DETAILS,
     requestOptions
   ).then(handleResponse);
 }
 
-function approveApplication(payload) {
+async function approveApplication(payload) {
   const requestOptions = {
     method: APP.REQUEST.POST,
     body: JSON.stringify(payload),
     headers: authHeader(),
   };
-  return fetch(
+  return await fetch(
     APIS.BASE_URL + APIS.REGULATOR.APPROVE_APPLICATION,
     requestOptions
   ).then(handleResponse);
 }
 
-function rejectApplication(payload) {
+async function rejectApplication(payload) {
   const requestOptions = {
     method: APP.REQUEST.POST,
     body: JSON.stringify(payload),
     headers: authHeader(),
   };
-  return fetch(
+  return await fetch(
     APIS.BASE_URL + APIS.REGULATOR.REJECT_APPLICATION,
     requestOptions
   ).then(handleResponse);
 }
 
-function consentApplication(payload) {
+async function consentApplication(payload) {
   const requestOptions = {
     method: APP.REQUEST.POST,
     body: JSON.stringify(payload),
     headers: authHeader(),
   };
-  return fetch(
+  return await fetch(
     APIS.BASE_URL + APIS.INSPECTOR.CONSENT_APPLICATION,
     requestOptions
   ).then(handleResponse);
-- 
GitLab