|
|
|
@ -4,19 +4,19 @@ const axios = require("axios");
|
|
|
|
|
const basePath = process.env.API_BASE_PATH; |
|
|
|
|
|
|
|
|
|
router.get("/", async (req, res) => { |
|
|
|
|
console.debug(basePath); |
|
|
|
|
const clients = await axios.get( |
|
|
|
|
basePath + "/clients", |
|
|
|
|
{}, |
|
|
|
|
{ headers: { Authorization: "Bearer " + req.token } } |
|
|
|
|
); |
|
|
|
|
console.log(clients); |
|
|
|
|
const clients = await axios |
|
|
|
|
.get(basePath + "/clients", { |
|
|
|
|
headers: { Authorization: "Bearer " + req.token }, |
|
|
|
|
}) |
|
|
|
|
.then((response) => response.data) |
|
|
|
|
.then((clients) => |
|
|
|
|
clients.map((c) => { |
|
|
|
|
return { ...c, id: c._id }; |
|
|
|
|
}) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
res.render("Clients", { |
|
|
|
|
clients: [ |
|
|
|
|
{ id: 1, name: "Foo Bar" }, |
|
|
|
|
{ id: 2, name: "Michael Jackson" }, |
|
|
|
|
], |
|
|
|
|
clients, |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|