From 7d0c7235177e4bf59da849438d2086d1a42f4b59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rune=20Moskvil=20Lyng=C3=A5s?= Date: Fri, 10 Jun 2022 09:10:05 +0200 Subject: [PATCH] `name` is required --- src/mocks/handlers.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/mocks/handlers.js b/src/mocks/handlers.js index 80a8a4c..711e5a7 100644 --- a/src/mocks/handlers.js +++ b/src/mocks/handlers.js @@ -70,6 +70,13 @@ export const handlers = [ ) }), rest.post(`${API.URL}/apikeys`, (req, res, ctx) => { + if (!req.body?.name) { + return res( + ctx.status(400), + ctx.json({ message: 'Error: name cannot be empty' }) + ) + } + const { fullitem } = getReqSearchParams(req) const apiKeys = get({ top: getTop(req), type: 'apikeys' }) const copyApiKey = apiKeys.data.length > 0 ? apiKeys.data[0] : _apikeys[0]