Skip to content
Snippets Groups Projects
Commit dce4d8cb authored by Haavardbm's avatar Haavardbm
Browse files

fixed search.js

Fixed issue where it did not check for exact match, and instead returned the first partial match it found
parent d964b51e
Branches feat/new-spec-file
No related tags found
1 merge request!8fixed search.js
Pipeline #128006 passed
......@@ -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}`);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment