js & img type

This commit is contained in:
Sergey Yarkov 2020-01-25 20:14:11 +03:00
parent c20037d8ed
commit e4fa09f07c
4 changed files with 8 additions and 4 deletions

View File

@ -80,7 +80,11 @@ module.exports = function(server, db) {
server.get('/api/buyers', checkAuthenticated, async (req, res) => { server.get('/api/buyers', checkAuthenticated, async (req, res) => {
try { try {
const buyers = await db.collection('buyers').find({}).toArray(); const buyers = await db.collection('buyers').find({}).toArray();
res.json(buyers); if (buyers.length > 0) {
res.json(buyers);
} else res.send({
error: 'Покупателей в магазине пока что нет.'
});
} catch { } catch {
res.status(500).render('main/404'); res.status(500).render('main/404');
} }

File diff suppressed because one or more lines are too long

View File

@ -11,7 +11,7 @@ header.admin-header
.user-view .user-view
.background .background
img(src="/img/admin/background-user.jpg", alt="#") img(src="/img/admin/background-user.jpg", alt="#")
span(style="padding-top: 5px;padding-bottom:10px;display:block;").white-text Control Panel v1.0.0 span(style="padding-top: 5px;padding-bottom:10px;display:block;").white-text Панель управления
a(href="#") a(href="#")
img(class="circle" src="/img/admin/avatar-user.jpg", alt="alt") img(class="circle" src="/img/admin/avatar-user.jpg", alt="alt")
a(href="#") a(href="#")

View File

@ -17,7 +17,7 @@ body.has-fixed-sidenav
.file-field.input-field.col.s12 .file-field.input-field.col.s12
.btn.orange .btn.orange
span Иконка span Иконка
input(type="file" name="img" required) input(type="file" accept="image/*" name="img" required)
.file-path-wrapper .file-path-wrapper
input(type="text" class="file-path" placeholder="Загрузите иконку в формате .svg") input(type="text" class="file-path" placeholder="Загрузите иконку в формате .svg")
button(type="submit" class="btn right" style="margin-right: 10px;") Добавить button(type="submit" class="btn right" style="margin-right: 10px;") Добавить