Skip to content

Commit

Permalink
Merge pull request #396 from Yelp/kdeal/create_subscription
Browse files Browse the repository at this point in the history
Add create subscription page
  • Loading branch information
Kyle Deal authored Oct 22, 2024
2 parents 4b6714a + 6780994 commit 790d22f
Show file tree
Hide file tree
Showing 8 changed files with 649 additions and 526 deletions.
31 changes: 31 additions & 0 deletions frontend/components/DisplayErrors.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React from "react";
import PropTypes from "prop-types";

const ErrorMessageShape = PropTypes.shape({
loc: PropTypes.arrayOf(
PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
),
msg: PropTypes.string.isRequired,
});

function DisplayErrorMessage({ errors }) {
return (
<div className="alert alert-danger mb-2" role="alert">
Error saving subscription.
<ul>
{errors.map((error) => (
<li key={JSON.stringify(error)}>
{error.loc && `${error.loc.join(".")}: `}
{error.msg}
</li>
))}
</ul>
</div>
);
}

DisplayErrorMessage.propTypes = {
errors: PropTypes.arrayOf(ErrorMessageShape).isRequired,
};

export default DisplayErrorMessage;
Loading

0 comments on commit 790d22f

Please sign in to comment.