Skip to content

issue-1083 #1090

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/actions/challenges.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,10 @@ export function createChallenge (challengeDetails) {
type: CREATE_CHALLENGE_SUCCESS,
challengeDetails: challenge
})
}).catch(() => {
}).catch((e) => {
dispatch({
type: CREATE_CHALLENGE_FAILURE
type: CREATE_CHALLENGE_FAILURE,
error: e
})
})
}
Expand Down
9 changes: 7 additions & 2 deletions src/components/ChallengeEditor/ChallengeEditor.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
span {
color: $tc-red;
}

}

.textRequired {
Expand Down Expand Up @@ -232,10 +233,13 @@
}

.error {
text-align: right;
padding-right: 40px;
padding-bottom: 20px;
color: $tc-red
color: $tc-red;

.errorMessage {
font-size: 25px;
}
}

.actionButtons {
Expand Down Expand Up @@ -332,6 +336,7 @@
line-height: 36px;
margin-bottom: 30px;
margin-top: 0;

}

span {
Expand Down
3 changes: 3 additions & 0 deletions src/components/ChallengeEditor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1160,6 +1160,7 @@ class ChallengeEditor extends Component {
token,
removeAttachment,
failedToLoad,
errorMessage,
projectDetail,
attachments
} = this.props
Expand Down Expand Up @@ -1187,6 +1188,7 @@ class ChallengeEditor extends Component {
<div className={styles.group}>
<div className={styles.row}>
<div className={styles.error}>
{errorMessage && <div className={styles.errorMessage}>{`Error : ${errorMessage}`}</div>}
Please try again later and if the issue persists contact us at&nbsp;
<a href='mailto:support@topcoder.com'>support@topcoder.com</a>
&nbsp;to resolve the issue as soon as possible.
Expand Down Expand Up @@ -1557,6 +1559,7 @@ ChallengeEditor.propTypes = {
attachments: PropTypes.arrayOf(PropTypes.shape()),
token: PropTypes.string.isRequired,
failedToLoad: PropTypes.bool,
errorMessage: PropTypes.string,
history: PropTypes.any.isRequired,
assignedMemberDetails: PropTypes.shape(),
updateChallengeDetails: PropTypes.func.isRequired,
Expand Down
8 changes: 6 additions & 2 deletions src/containers/ChallengeEditor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ class ChallengeEditor extends Component {
token,
removeAttachment,
failedToLoad,
errorMessage,
projectDetail,
updateChallengeDetails,
partiallyUpdateChallengeDetails,
Expand Down Expand Up @@ -325,6 +326,7 @@ class ChallengeEditor extends Component {
token={token}
removeAttachment={removeAttachment}
failedToLoad={failedToLoad}
errorMessage={errorMessage}
projectDetail={projectDetail}
assignedMemberDetails={assignedMemberDetails}
updateChallengeDetails={updateChallengeDetails}
Expand Down Expand Up @@ -422,6 +424,7 @@ ChallengeEditor.propTypes = {
loggedInUser: PropTypes.object,
removeAttachment: PropTypes.func,
failedToLoad: PropTypes.bool,
errorMessage: PropTypes.string,
updateChallengeDetails: PropTypes.func.isRequired,
partiallyUpdateChallengeDetails: PropTypes.func.isRequired,
createChallenge: PropTypes.func.isRequired,
Expand All @@ -431,7 +434,7 @@ ChallengeEditor.propTypes = {
// members: PropTypes.arrayOf(PropTypes.shape())
}

const mapStateToProps = ({ projects, challenges: { challengeDetails, challengeResources, metadata, isLoading, attachments, failedToLoad }, auth: { token, user }, members: { members } }) => ({
const mapStateToProps = ({ projects, challenges: { challengeDetails, challengeResources, metadata, isLoading, attachments, failedToLoad, errorMessage }, auth: { token, user }, members: { members } }) => ({
challengeDetails,
hasProjectAccess: projects.hasProjectAccess,
projectDetail: projects.projectDetail,
Expand All @@ -442,7 +445,8 @@ const mapStateToProps = ({ projects, challenges: { challengeDetails, challengeRe
attachments,
token,
loggedInUser: user,
failedToLoad
failedToLoad,
errorMessage
// members
})

Expand Down
2 changes: 1 addition & 1 deletion src/reducers/challenges.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export default function (state = initialState, action) {
return { ...state, isLoading: false }
case LOAD_CHALLENGE_DETAILS_FAILURE:
case CREATE_CHALLENGE_FAILURE:
return { ...state, isLoading: false, attachments: [], challenge: null, failedToLoad: true }
return { ...state, isLoading: false, attachments: [], challenge: null, failedToLoad: true, errorMessage: _.get(action, 'error.response.data.message', '') }
case LOAD_CHALLENGE_DETAILS_SUCCESS: {
return {
...state,
Expand Down