From ddac61e53fbcda3da9a75ec38775f90117006191 Mon Sep 17 00:00:00 2001 From: pepper Date: Mon, 18 Jan 2021 01:44:00 -0500 Subject: [PATCH] Changed error import and added helper functions --- src/components/actions/Error.js | 13 +++++++++++-- src/components/root/Pages/GenericList.js | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/components/actions/Error.js b/src/components/actions/Error.js index 4ac6ae9..ea7b929 100644 --- a/src/components/actions/Error.js +++ b/src/components/actions/Error.js @@ -2,7 +2,7 @@ import React from "react"; // Generic error -const Error = () => ( +export const Error = () => (
@@ -16,4 +16,13 @@ const Error = () => (
); -export default Error; +export function buildErrorStringFromArray(error) { + let errors = [] + for (let key in error) { + errors.push(key + ": " + error[key]) + // console.log(key + ": " + error[key]) + } + return errors +} + +// export default Error; diff --git a/src/components/root/Pages/GenericList.js b/src/components/root/Pages/GenericList.js index e6171cb..df04fea 100644 --- a/src/components/root/Pages/GenericList.js +++ b/src/components/root/Pages/GenericList.js @@ -1,7 +1,7 @@ import React, { Component } from "react"; import CompTable from "../common/Tables/CompTable"; import { callAPI } from "../../actions/API" -import Error from "../../actions/Error"; +import { Error } from "../../actions/Error"; // Missing parent page, // Most of the good stuff is happening in UpcomingSingle, which does the