generated from lucien/api-template
fix: improved searchs
This commit is contained in:
parent
b2d8acaa5d
commit
8d6e1f8618
3 changed files with 3 additions and 3 deletions
|
@ -46,7 +46,7 @@ const router = express.Router();
|
||||||
router.get('/', async (req, res) => {
|
router.get('/', async (req, res) => {
|
||||||
const { search } = req.query;
|
const { search } = req.query;
|
||||||
const connection = await getConnection();
|
const connection = await getConnection();
|
||||||
if (search) {
|
if (search || search === '') {
|
||||||
const channels = await searchChannels(connection, search);
|
const channels = await searchChannels(connection, search);
|
||||||
connection.end();
|
connection.end();
|
||||||
return res.send(channels);
|
return res.send(channels);
|
||||||
|
|
|
@ -29,7 +29,7 @@ upload.limits = {
|
||||||
router.get('/', async (req, res) => {
|
router.get('/', async (req, res) => {
|
||||||
const { search } = req.query;
|
const { search } = req.query;
|
||||||
const connection = await getConnection();
|
const connection = await getConnection();
|
||||||
if (search) {
|
if (search || search === '') {
|
||||||
const emojis = await searchEmojis(connection, search);
|
const emojis = await searchEmojis(connection, search);
|
||||||
connection.end();
|
connection.end();
|
||||||
return res.send(emojis);
|
return res.send(emojis);
|
||||||
|
|
|
@ -21,7 +21,7 @@ const router = express.Router();
|
||||||
router.get('/', async (req, res) => {
|
router.get('/', async (req, res) => {
|
||||||
const { search } = req.query;
|
const { search } = req.query;
|
||||||
const connection = await getConnection();
|
const connection = await getConnection();
|
||||||
if (search) {
|
if (search || search === '') {
|
||||||
const users = await searchUser(connection, search);
|
const users = await searchUser(connection, search);
|
||||||
connection.end();
|
connection.end();
|
||||||
return res.send(users);
|
return res.send(users);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue