add mock data for endpoints

This commit is contained in:
medcl 2020-03-21 17:54:31 +08:00
parent 7e29e9dac6
commit 917b019290
1 changed files with 36 additions and 0 deletions

View File

@ -0,0 +1,36 @@
const random_endpoints = [
{
os: 'Windows',
name: "LENOVO",
ip: '192.168.3.1',
status: "active", //active/inactive/unmonitored
last_active: "2020-03-21 11:12:33"
},
{
os: 'Windows',
ip: '192.168.3.100',
},
{
os: 'Linux',
ip: '192.168.3.91',
},
];
let random_endpoint_pick = 0;
export default {
'get /endpoints/get_endpoints': function (req, res) {
setTimeout(() => {
res.json(random_endpoints);
}, 3000);
},
'get /endpoints/get_endpoint/1': function (req, res) {
const responseObj = random_endpoints[random_endpoint_pick % random_endpoints.length];
random_endpoint_pick += 1;
setTimeout(() => {
res.json(responseObj);
}, 3000);
},
};