diff --git a/www/scripts/search.js b/www/scripts/search.js index c36f812b1b5a07b4d88553df4d23c0e1f9752306..f171f390cb7c62aba31f0dfc2b6908bfb6e25c99 100644 --- a/www/scripts/search.js +++ b/www/scripts/search.js @@ -35,7 +35,12 @@ async function profileSearchSubmitted(event) { const searchValue = document.getElementById("profileSearch").value - let profileMatches = users.filter((user) => user.username.includes(searchValue)); + let profileMatches = users.filter((user) => user.username === searchValue); + + //if there were no exact match, then check for partial match + if (profileMatches.length === 0){ + profileMatches = users.filter((user) => user.username.includes(searchValue)); + } try { window.location.assign(`profilepage.html?id=${profileMatches[0].id}`);