mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2024-11-12 18:04:29 +01:00
Use join function for simplicity
This commit is contained in:
parent
738f863581
commit
374ddc74bd
2 changed files with 4 additions and 4 deletions
|
@ -23,7 +23,7 @@ export async function postClearCache(req: Request, res: Response): Promise<Respo
|
|||
|
||||
if (invalidFields.length !== 0) {
|
||||
// invalid request
|
||||
const fields = invalidFields.reduce((p, c, i) => p + (i !== 0 ? ", " : "") + c, "");
|
||||
const fields = invalidFields.join(", ");
|
||||
return res.status(400).send(`No valid ${fields} field(s) provided`);
|
||||
}
|
||||
|
||||
|
|
|
@ -242,11 +242,11 @@ async function checkInvalidFields(videoID: VideoID, userID: UserID, hashedUserID
|
|||
|
||||
if (invalidFields.length !== 0) {
|
||||
// invalid request
|
||||
const formattedFields = invalidFields.reduce((p, c, i) => p + (i !== 0 ? ", " : "") + c, "");
|
||||
const formattedErrors = errors.reduce((p, c, i) => p + (i !== 0 ? ". " : " ") + c, "");
|
||||
const formattedFields = invalidFields.join(", ");
|
||||
const formattedErrors = errors.join(". ");
|
||||
return {
|
||||
pass: false,
|
||||
errorMessage: `No valid ${formattedFields}.${formattedErrors}`,
|
||||
errorMessage: `No valid ${formattedFields}. ${formattedErrors}`,
|
||||
errorCode: 400
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue