Skip to content
Snippets Groups Projects
Commit 74fda480 authored by Håvard Borgen Myrekrok's avatar Håvard Borgen Myrekrok
Browse files

Merge branch 'fix-search.js' into 'master'

fixed search.js

See merge request !8
parents 7466a397 dce4d8cb
No related branches found
No related tags found
1 merge request!8fixed search.js
Pipeline #128074 passed
...@@ -35,7 +35,12 @@ async function profileSearchSubmitted(event) { ...@@ -35,7 +35,12 @@ async function profileSearchSubmitted(event) {
const searchValue = document.getElementById("profileSearch").value 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 { try {
window.location.assign(`profilepage.html?id=${profileMatches[0].id}`); 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