fix: backend projects not submitting (#38900)

Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
This commit is contained in:
Tom
2020-05-26 08:48:57 -05:00
committed by Mrugesh Mohapatra
parent 911ba72106
commit db08ab2965
3 changed files with 4 additions and 18 deletions

View File

@ -13,7 +13,6 @@ import {
consoleOutputSelector, consoleOutputSelector,
initConsole, initConsole,
initTests, initTests,
updateBackendFormValues,
updateChallengeMeta, updateChallengeMeta,
updateSolutionFormValues updateSolutionFormValues
} from '../../redux'; } from '../../redux';
@ -53,7 +52,6 @@ const propTypes = {
}), }),
tests: PropTypes.array, tests: PropTypes.array,
title: PropTypes.string, title: PropTypes.string,
updateBackendFormValues: PropTypes.func.isRequired,
updateChallengeMeta: PropTypes.func.isRequired, updateChallengeMeta: PropTypes.func.isRequired,
updateSolutionFormValues: PropTypes.func.isRequired updateSolutionFormValues: PropTypes.func.isRequired
}; };
@ -74,7 +72,6 @@ const mapDispatchToActions = {
executeChallenge, executeChallenge,
initConsole, initConsole,
initTests, initTests,
updateBackendFormValues,
updateChallengeMeta, updateChallengeMeta,
updateSolutionFormValues updateSolutionFormValues
}; };
@ -155,7 +152,7 @@ export class BackEnd extends Component {
}, },
tests, tests,
executeChallenge, executeChallenge,
updateBackendFormValues updateSolutionFormValues
} = this.props; } = this.props;
const blockNameTitle = `${blockName} - ${title}`; const blockNameTitle = `${blockName} - ${title}`;
@ -181,7 +178,7 @@ export class BackEnd extends Component {
<SolutionForm <SolutionForm
challengeType={challengeType} challengeType={challengeType}
onSubmit={executeChallenge} onSubmit={executeChallenge}
updateSolutionForm={updateBackendFormValues} updateSolutionForm={updateSolutionFormValues}
/> />
<ProjectToolPanel <ProjectToolPanel
guideUrl={getGuideUrl({ forumTopicId, title })} guideUrl={getGuideUrl({ forumTopicId, title })}

View File

@ -11,7 +11,6 @@ import { ofType } from 'redux-observable';
import { navigate } from 'gatsby'; import { navigate } from 'gatsby';
import { import {
backendFormValuesSelector,
projectFormValuesSelector, projectFormValuesSelector,
types, types,
challengeMetaSelector, challengeMetaSelector,
@ -108,7 +107,7 @@ function submitBackendChallenge(type, state) {
const { username } = userSelector(state); const { username } = userSelector(state);
const { const {
solution: { value: solution } solution: { value: solution }
} = backendFormValuesSelector(state); } = projectFormValuesSelector(state);
const challengeInfo = { id, solution }; const challengeInfo = { id, solution };
const update = { const update = {

View File

@ -52,7 +52,6 @@ export const types = createTypes(
'initTests', 'initTests',
'initConsole', 'initConsole',
'initLogs', 'initLogs',
'updateBackendFormValues',
'updateConsole', 'updateConsole',
'updateChallengeMeta', 'updateChallengeMeta',
'updateFile', 'updateFile',
@ -128,9 +127,6 @@ export const cancelTests = createAction(types.cancelTests);
export const initConsole = createAction(types.initConsole); export const initConsole = createAction(types.initConsole);
export const initLogs = createAction(types.initLogs); export const initLogs = createAction(types.initLogs);
export const updateBackendFormValues = createAction(
types.updateBackendFormValues
);
export const updateChallengeMeta = createAction(types.updateChallengeMeta); export const updateChallengeMeta = createAction(types.updateChallengeMeta);
export const updateFile = createAction(types.updateFile); export const updateFile = createAction(types.updateFile);
export const updateConsole = createAction(types.updateConsole); export const updateConsole = createAction(types.updateConsole);
@ -190,8 +186,6 @@ export const isResetModalOpenSelector = state => state[ns].modal.reset;
export const isBuildEnabledSelector = state => state[ns].isBuildEnabled; export const isBuildEnabledSelector = state => state[ns].isBuildEnabled;
export const successMessageSelector = state => state[ns].successMessage; export const successMessageSelector = state => state[ns].successMessage;
export const backendFormValuesSelector = state =>
state[ns].backendFormValues || {};
export const projectFormValuesSelector = state => export const projectFormValuesSelector = state =>
state[ns].projectFormValues || {}; state[ns].projectFormValues || {};
@ -207,7 +201,7 @@ export const challengeDataSelector = state => {
files: challengeFilesSelector(state) files: challengeFilesSelector(state)
}; };
} else if (challengeType === challengeTypes.backend) { } else if (challengeType === challengeTypes.backend) {
const { solution: url = {} } = backendFormValuesSelector(state); const { solution: url = {} } = projectFormValuesSelector(state);
challengeData = { challengeData = {
...challengeData, ...challengeData,
url url
@ -329,10 +323,6 @@ export const reducer = handleActions(
})), })),
consoleOut: '' consoleOut: ''
}), }),
[types.updateBackendFormValues]: (state, { payload }) => ({
...state,
backendFormValues: payload
}),
[types.updateSolutionFormValues]: (state, { payload }) => ({ [types.updateSolutionFormValues]: (state, { payload }) => ({
...state, ...state,
projectFormValues: payload projectFormValues: payload