Browse Source

Detect by search string length what to search for

stuff
xcps 6 years ago
parent
commit
33d9bd112c
  1. 5
      routes/search.js

5
routes/search.js

@ -26,6 +26,7 @@ router.post('/', async function(req, res, next) { @@ -26,6 +26,7 @@ router.post('/', async function(req, res, next) {
}
}
if (search.length === 34) {
// looking for address
const address = await models.Address.findOne({
where: {
@ -36,7 +37,7 @@ router.post('/', async function(req, res, next) { @@ -36,7 +37,7 @@ router.post('/', async function(req, res, next) {
res.redirect(`/address/${address.address}/`);
return;
}
} else if(search.length === 64) {
// looking for transaction
const transaction = await models.Transaction.findOne({
where: {
@ -58,6 +59,8 @@ router.post('/', async function(req, res, next) { @@ -58,6 +59,8 @@ router.post('/', async function(req, res, next) {
res.redirect(`/block/${block.hash}/`);
return;
}
}
res.status(404).render('404');
});

Loading…
Cancel
Save