Browse Source

Detect by search string length what to search for

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

Loading…
Cancel
Save