From f5ae5027ccca043fa67138f04d38a9ce57be7f15 Mon Sep 17 00:00:00 2001 From: Bouncey Date: Thu, 8 Nov 2018 13:43:09 +0000 Subject: [PATCH] fix: Update some apis/datastructures --- api-server/server/boot/settings.js | 14 +++++++++++--- .../src/components/profile/components/TimeLine.js | 10 ++++++---- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/api-server/server/boot/settings.js b/api-server/server/boot/settings.js index e2ce0e3646..80d1317bff 100644 --- a/api-server/server/boot/settings.js +++ b/api-server/server/boot/settings.js @@ -104,9 +104,17 @@ function updateMyCurrentChallenge(req, res, next) { user, body: { currentChallengeId } } = req; - return user - .update$({ currentChallengeId }) - .subscribe(() => res.status(200), next); + return user.updateAttribute( + 'currentChallengeId', + currentChallengeId, + (err, updatedUser) => { + if (err) { + return next(err); + } + const { currentChallengeId } = updatedUser; + return res.status(200).json(currentChallengeId); + } + ); } const updateMyThemeValidators = [ diff --git a/client/src/components/profile/components/TimeLine.js b/client/src/components/profile/components/TimeLine.js index 5c78b28c0f..8e4ba655b9 100644 --- a/client/src/components/profile/components/TimeLine.js +++ b/client/src/components/profile/components/TimeLine.js @@ -33,10 +33,12 @@ const propTypes = { completedDate: PropTypes.number, challengeType: PropTypes.number, solution: PropTypes.string, - files: PropTypes.shape({ - ext: PropTypes.string, - contents: PropTypes.string - }) + files: PropTypes.arrayOf( + PropTypes.shape({ + ext: PropTypes.string, + contents: PropTypes.string + }) + ) }) ), fetchIdToNameMap: PropTypes.func.isRequired,