From 2b778223e3085c9f0bbbce742613750e16745eaa Mon Sep 17 00:00:00 2001 From: pepper Date: Tue, 19 Jan 2021 01:24:22 -0500 Subject: [PATCH] Updated error function --- src/components/actions/Error.js | 10 ++-- src/components/actions/Msgbox.js | 49 +++++++++++++------ .../common/Functionality/UnorderedList.js | 20 +++++--- 3 files changed, 53 insertions(+), 26 deletions(-) diff --git a/src/components/actions/Error.js b/src/components/actions/Error.js index ea7b929..7084200 100644 --- a/src/components/actions/Error.js +++ b/src/components/actions/Error.js @@ -16,13 +16,13 @@ export const Error = () => ( ); -export function buildErrorStringFromArray(error) { - let errors = [] +export function builfArrayFromObject(error) { + let errors = []; for (let key in error) { - errors.push(key + ": " + error[key]) + errors.push(key + ": " + error[key]); // console.log(key + ": " + error[key]) - } - return errors + } + return errors; } // export default Error; diff --git a/src/components/actions/Msgbox.js b/src/components/actions/Msgbox.js index 421bdba..4d49794 100644 --- a/src/components/actions/Msgbox.js +++ b/src/components/actions/Msgbox.js @@ -3,21 +3,42 @@ import { UList } from "../root/common/Functionality/UnorderedList"; // // Generic Msgbox function Msgbox(props) { - return
-
-
-
- - { props.error ? { "Unable to update: " } - : props.msg ? { "Updated migration details for: " + props.msg } - : props.linkid ? {process.env.REACT_APP_SITE_URL + "migrations/" + props.linkid } - : null} - -
+ return ( +
+
+
+
+ + {props.error ? ( + + {" "} + {"Error: "}{" "} + {" "} + + ) : props.msg ? ( + + {"Updated migration details for: " + props.msg} + + ) : props.linkid ? ( + + {process.env.REACT_APP_SITE_URL + + "migrations/" + + props.linkid} + + ) : null} + +
+
-
; - } + ); +} export default Msgbox; diff --git a/src/components/root/common/Functionality/UnorderedList.js b/src/components/root/common/Functionality/UnorderedList.js index d6d6cb1..d21250a 100644 --- a/src/components/root/common/Functionality/UnorderedList.js +++ b/src/components/root/common/Functionality/UnorderedList.js @@ -1,9 +1,15 @@ import React from "react"; -export function UList(props){ - return (
-
    - {props.listItems.map((item) => (
  • {item}
  • ))} -
-
) -} \ No newline at end of file +export function UList(props) { + return ( +
+
    + {props.listItems.map((item) => ( +
  • + {item} +
  • + ))} +
+
+ ); +}