import React from 'react'; import PropTypes from 'prop-types'; import { withTranslation } from 'react-i18next'; const ApiErrorMessage = (props) => { const { t, errorMessage, linkPath } = props; function renderMessage() { switch (errorMessage) { case 'Page exists': return ( { t('page_api_error.already_exists') } {linkPath} ); default: return null; } } return ( <> {renderMessage()} ); // TODO GW-79 Set according to error message //
// // { t('page_api_error.notfound_or_forbidden') } // // // { t('page_api_error.user_not_admin') } // // // { t('page_api_error.outdated') } // {/* */} // { t('Load latest') } // {/* */} // // // Invalid path // // // Unknown error occured // //
}; ApiErrorMessage.propTypes = { t: PropTypes.func.isRequired, // i18next errorMessage: PropTypes.string, linkPath: PropTypes.string, }; export default withTranslation()(ApiErrorMessage);