feat: reduce request payload for non-js projects (#44429)
* feat: reduce request payload for non-js projects * break future TS Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com> Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>pull/44443/head
parent
1c5d136add
commit
40acfa708b
|
@ -62,16 +62,19 @@ function submitModern(type, state) {
|
|||
}
|
||||
|
||||
if (type === actionTypes.submitChallenge) {
|
||||
const { id } = challengeMetaSelector(state);
|
||||
const { id, block } = challengeMetaSelector(state);
|
||||
const challengeFiles = challengeFilesSelector(state);
|
||||
const { username } = userSelector(state);
|
||||
const challengeInfo = {
|
||||
id,
|
||||
files: challengeFiles.reduce(
|
||||
id
|
||||
};
|
||||
// Only send files to server, if it is a JS project
|
||||
if (block === 'javascript-algorithms-and-data-structures-projects') {
|
||||
challengeInfo.files = challengeFiles.reduce(
|
||||
(acc, { fileKey, ...curr }) => [...acc, { ...curr, key: fileKey }],
|
||||
[]
|
||||
)
|
||||
};
|
||||
);
|
||||
}
|
||||
const update = {
|
||||
endpoint: '/modern-challenge-completed',
|
||||
payload: challengeInfo
|
||||
|
|
Loading…
Reference in New Issue