Skip to content

Instantly share code, notes, and snippets.

@esshka
Created September 26, 2018 16:19
Show Gist options
  • Save esshka/0c116421f1419b34f0c0797ec199b794 to your computer and use it in GitHub Desktop.
Save esshka/0c116421f1419b34f0c0797ec199b794 to your computer and use it in GitHub Desktop.
const ErrorsContainer = ({errors}) => {
if (errors.length === 0) {
return null;
}
return errors.map(err => {
if (err.displayType === MODAL_ERROR_DISPLAY_TYPE) {
return <ModalError error={err} key={Math.random()} />;
}
if (err.displayType === EAPI_TIMEOUT_ERROR_DISPLAY_TYPE) {
return <ModalError error={err} key={Math.random()} withActionOk />;
}
return <InlineError error={err} key={Math.random()} />;
});
};
export default ErrorsContainer;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment