search white space trim

This commit is contained in:
feruz 2019-12-23 13:16:17 +02:00
parent d54dc77ff5
commit 1f4b63126e

View File

@ -46,7 +46,7 @@ const SearchModalContainer = ({
} }
if (text && text !== '@' && text !== '#') { if (text && text !== '@' && text !== '#') {
if (text[0] === '@') { if (text[0] === '@') {
lookupAccounts(text.substr(1)).then(res => { lookupAccounts(text.substr(1).trim()).then(res => {
const users = res.map(item => ({ const users = res.map(item => ({
image: getResizedAvatar(item), image: getResizedAvatar(item),
text: item, text: item,
@ -55,7 +55,7 @@ const SearchModalContainer = ({
setSearchResults({ type: 'user', data: users }); setSearchResults({ type: 'user', data: users });
}); });
} else if (text[0] === '#') { } else if (text[0] === '#') {
getTrendingTags(text.substr(1)).then(res => { getTrendingTags(text.substr(1).trim()).then(res => {
const tags = res.map(item => ({ const tags = res.map(item => ({
text: `#${get(item, 'name', '')}`, text: `#${get(item, 'name', '')}`,
...item, ...item,