Skip to content
Snippets Groups Projects

fixed search.js

Merged Håvard Borgen Myrekrok requested to merge fix-search.js into master
1 file
+ 6
1
Compare changes
  • Side-by-side
  • Inline
+ 6
1
@@ -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}`);
Loading