From 5ef0d5953dab7c2c6a6544c154098f32aa4ba251 Mon Sep 17 00:00:00 2001 From: ilnaz <237x237@gmail.com> Date: Sun, 1 Dec 2024 11:51:52 +0300 Subject: [PATCH] feat: add stub admin (#43) --- stubs/api/index.js | 59 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/stubs/api/index.js b/stubs/api/index.js index 4a9e3a7..6a7dc94 100644 --- a/stubs/api/index.js +++ b/stubs/api/index.js @@ -2,4 +2,63 @@ /* eslint-disable @typescript-eslint/no-require-imports */ const router = require('express').Router(); +const commonError = { success: false, message: 'Что то пошло не так' }; + +const stubs = { masters: 'success', orders: 'success' }; + +router.get('/arm/masters', (req, res) => { + res + .status(/error/.test(stubs.masters) ? 500 : 200) + .send( + /^error$/.test(stubs.masters) + ? commonError + : require(`../json/arm-masters/${stubs.masters}.json`), + ); +}); + +router.get('/arm/orders', (req, res) => { + res + .status(/error/.test(stubs.orders) ? 500 : 200) + .send( + /^error$/.test(stubs.orders) + ? commonError + : require(`../json/arm-orders/${stubs.orders}.json`), + ); +}); + +router.get('/admin', (req, res) => { + res.send(`