返回提交历史
Modified
src/controllers/api/claimJunctionChallengeRewardController.ts
+4
-1
XFEstudio/XFESpaceNinjaServer
chore: handle missing ChallengeProgress entry in claimJunctionChallengeRewardController (#3183)
Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/3183 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
e6211087
代码差异
1 个文件
+4
-1
@@ -9,7 +9,10 @@ export const claimJunctionChallengeRewardController: RequestHandler = async (req
9
9
const accountId = await getAccountIdForRequest(req);
10
10
const inventory = await getInventory(accountId);
11
11
const data = getJSONfromString<IClaimJunctionChallengeRewardRequest>(String(req.body));
12
const challengeProgress = inventory.ChallengeProgress.find(x => x.Name == data.Challenge)!;
12
const challengeProgress = inventory.ChallengeProgress.find(x => x.Name == data.Challenge);
13
if (!challengeProgress) {
14
throw new Error(`attempt to claim challenge with no progress: ${String(req.body)}`);
15
}
13
16
if (challengeProgress.ReceivedJunctionReward) {
14
17
throw new Error(`attempt to double-claim junction reward`);
15
18
}