From 2eca125974da22c1fdb97fabeaaf2145be52b233 Mon Sep 17 00:00:00 2001 From: bsourisse Date: Tue, 6 Jun 2023 18:49:41 +0200 Subject: [PATCH] fix: lanCommand is optionnal in form --- pages/api/repo/add.js | 4 ++-- pages/api/repo/id/[slug]/edit.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pages/api/repo/add.js b/pages/api/repo/add.js index 613d7d7..273f72a 100644 --- a/pages/api/repo/add.js +++ b/pages/api/repo/add.js @@ -17,8 +17,8 @@ export default async function handler(req, res) { //The data we expect to receive const { alias, sshPublicKey, size, comment, alert, lanCommand } = req.body; - //We check that we receive data for each variable. Only "comment" is optional in the form. - if (!alias || !sshPublicKey || !size || !alert || !lanCommand) { + //We check that we receive data for each variable. Only "comment" and "lanCommand" are optional in the form. + if (!alias || !sshPublicKey || !size || !alert) { //If a variable is empty. res.status(422).json({ message: 'Unexpected data', diff --git a/pages/api/repo/id/[slug]/edit.js b/pages/api/repo/id/[slug]/edit.js index 7fe6d4b..f70b9e1 100644 --- a/pages/api/repo/id/[slug]/edit.js +++ b/pages/api/repo/id/[slug]/edit.js @@ -17,8 +17,8 @@ export default async function handler(req, res) { //The data we expect to receive const { alias, sshPublicKey, size, comment, alert, lanCommand } = req.body; - //We check that we receive data for each variable. Only "comment" is optional in the form. - if (!alias || !sshPublicKey || !size || !alert || !lanCommand) { + //We check that we receive data for each variable. Only "comment" and "lanCommand" are optional in the form. + if (!alias || !sshPublicKey || !size || !alert) { //If a variable is empty. res.status(422).json({ message: 'Unexpected data',