fix(client): convert challengeFiles->files before sending to api (#43204)
* fix(client): convert challengeFiles->files before sending to api * update use of user.completeChallenges * parse response in ajax, pre-typing * add typing to getSessionUser * refactor: use Omit * fix: reorganise getSessionUser * refactor ajax for simplicity * refactor to be worse * allow for undefined completedChallenges Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com> Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
This commit is contained in:
@ -83,11 +83,9 @@ export function buildUserUpdate(
|
||||
if (jsProjects.includes(challengeId)) {
|
||||
completedChallenge = {
|
||||
..._completedChallenge,
|
||||
files: Object.keys(files)
|
||||
.map(key => files[key])
|
||||
.map(file =>
|
||||
pick(file, ['contents', 'key', 'index', 'name', 'path', 'ext'])
|
||||
)
|
||||
files: files.map(file =>
|
||||
pick(file, ['contents', 'key', 'index', 'name', 'path', 'ext'])
|
||||
)
|
||||
};
|
||||
} else {
|
||||
completedChallenge = omit(_completedChallenge, ['files']);
|
||||
|
Reference in New Issue
Block a user