generated from lucien/api-template
fix: improved searchs
This commit is contained in:
parent
fb90f1ef4f
commit
b2d8acaa5d
9 changed files with 39 additions and 50 deletions
|
@ -84,7 +84,7 @@ export default function MessageComponent({ message, user, channel }: {
|
|||
if (lastWord && lastWord.startsWith("@")) {
|
||||
const username = lastWord.slice(1);
|
||||
axios
|
||||
.get(`/api/searchuser?search=${username}`)
|
||||
.get(`/api/users?search=${username}`)
|
||||
.then((res) => {
|
||||
setSearchedUsers(res.data);
|
||||
})
|
||||
|
@ -98,7 +98,7 @@ export default function MessageComponent({ message, user, channel }: {
|
|||
if (lastWord && lastWord.startsWith(":")) {
|
||||
const emojiName = lastWord.slice(1);
|
||||
axios
|
||||
.get(`/api/searchemojis?search=${emojiName}`)
|
||||
.get(`/api/emojis?search=${emojiName}`)
|
||||
.then((res) => {
|
||||
setSearchedEmojis(res.data);
|
||||
})
|
||||
|
|
|
@ -126,7 +126,7 @@ export default function ChannelPage({socket}: {socket: WebSocket}) {
|
|||
if (lastWord && lastWord.startsWith("@")) {
|
||||
const username = lastWord.slice(1);
|
||||
axios
|
||||
.get(`/api/searchuser?search=${username}`)
|
||||
.get(`/api/users?search=${username}`)
|
||||
.then((res) => {
|
||||
setSearchedUsers(res.data);
|
||||
})
|
||||
|
@ -140,7 +140,7 @@ export default function ChannelPage({socket}: {socket: WebSocket}) {
|
|||
if (lastWord && lastWord.startsWith(":")) {
|
||||
const emojiName = lastWord.slice(1);
|
||||
axios
|
||||
.get(`/api/searchemojis?search=${emojiName}`)
|
||||
.get(`/api/emojis?search=${emojiName}`)
|
||||
.then((res) => {
|
||||
setSearchedEmojis(res.data);
|
||||
})
|
||||
|
|
|
@ -135,7 +135,7 @@ export default function Home({socket}: {socket: WebSocket}) {
|
|||
return
|
||||
}
|
||||
axios
|
||||
.get(`/api/searchchannels?search=${search}`).then((res) => {
|
||||
.get(`/api/channels?search=${search}`).then((res) => {
|
||||
setSearchedChannels(res.data)
|
||||
}
|
||||
).catch((err) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue