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
Shaun Hamilton 2021-12-09 19:31:21 +00:00 committed by GitHub
parent 1c5d136add
commit 40acfa708b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 5 deletions

View File

@ -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