Skip to content

Commit 085638c

Browse files
Added so you can search for course name or course code
1 parent b380163 commit 085638c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

overload/src/app/components/SearchBar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ export const SearchBar = () => {
2323
fetch('http://localhost:3000/api/home', { cache: 'no-store' }) // Fetch terms
2424
.then((response) => response.json()) // turn data from promise into a json file so we can use data
2525
.then((data) => {
26-
console.log(data);
2726
setDataList(data);
2827
}) // set data using setData hook
2928
.catch((error) => {
@@ -33,7 +32,8 @@ export const SearchBar = () => {
3332
}, []);
3433

3534
const filteredData: Term[] = dataList.filter((item: Term) =>
36-
item.course.courseName.toLowerCase().includes(searchTerm.toLowerCase())
35+
item.course.courseName.toLowerCase().includes(searchTerm.toLowerCase()) ||
36+
item.course.courseCode.toLowerCase().includes(searchTerm.toLocaleLowerCase())
3737
);
3838

3939
const courseCards = filteredData.map((item, idx) => {

0 commit comments

Comments
 (0)