fix: lanCommand is optionnal in form

This commit is contained in:
bsourisse 2023-06-06 18:49:41 +02:00
parent 5f0b47019b
commit 2eca125974
2 changed files with 4 additions and 4 deletions

View file

@ -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',

View file

@ -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',