Used validateAsync instead of validate.
This commit is contained in:
1 parent
683006ae84
commit
fc09aee094
1 file changed
+3
-3
@@ -14,7 +14,7 @@ const { pageSpeedCheckValidation } = require("../validation/joi");
|
|||||||
const getPageSpeedChecks = async (req, res, next) => {
|
const getPageSpeedChecks = async (req, res, next) => {
|
||||||
try {
|
try {
|
||||||
// Validate monitorId parameter
|
// Validate monitorId parameter
|
||||||
const { error } = pageSpeedCheckValidation.validate(req.params);
|
const { error } = pageSpeedCheckValidation.validateAsync(req.params);
|
||||||
if (error) {
|
if (error) {
|
||||||
return res.status(400).json({ error: error.details[0].message });
|
return res.status(400).json({ error: error.details[0].message });
|
||||||
}
|
}
|
||||||
@@ -36,7 +36,7 @@ const getPageSpeedChecks = async (req, res, next) => {
|
|||||||
const createPageSpeedCheck = async (req, res, next) => {
|
const createPageSpeedCheck = async (req, res, next) => {
|
||||||
try {
|
try {
|
||||||
// Validate monitorId parameter
|
// Validate monitorId parameter
|
||||||
const { error } = pageSpeedCheckValidation.validate(req.params);
|
const { error } = pageSpeedCheckValidation.validateAsync(req.params);
|
||||||
if (error) {
|
if (error) {
|
||||||
return res.status(400).json({ error: error.details[0].message });
|
return res.status(400).json({ error: error.details[0].message });
|
||||||
}
|
}
|
||||||
@@ -59,7 +59,7 @@ const createPageSpeedCheck = async (req, res, next) => {
|
|||||||
const deletePageSpeedCheck = async (req, res, next) => {
|
const deletePageSpeedCheck = async (req, res, next) => {
|
||||||
try {
|
try {
|
||||||
// Validate monitorId parameter
|
// Validate monitorId parameter
|
||||||
const { error } = pageSpeedCheckValidation.validate(req.params);
|
const { error } = pageSpeedCheckValidation.validateAsync(req.params);
|
||||||
if (error) {
|
if (error) {
|
||||||
return res.status(400).json({ error: error.details[0].message });
|
return res.status(400).json({ error: error.details[0].message });
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user