Skip to content

fixed search #10

Merged
merged 1 commit into from
Nov 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions class_registration_app/src/components/CourseSearch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function handleSearch() {
//arn:aws:execute-api:us-east-1:671289147354:5prodolbi7/*/GET/courses
const apiUrl = 'https://5prodolbi7.execute-api.us-east-1.amazonaws.com/Beta';
const response = fetch(`${apiUrl}/courses`);
let courseJson = fetch(`${apiUrl}/courses`)
.then(response => {
if (response.ok) {
Expand All @@ -27,7 +27,7 @@ function handleSearch() {
console.log(response.Items);
let searchbar = document.getElementById("search");
let filteredCourses = response.Items.filter(function (str: string) { return str.CourseId.includes(searchbar.value.toUpperCase())} );
filteredCourses.forEach((Course: { CourseId: string; CourseLocation: string;}) => {
let container = document.getElementById("container");
Expand Down Expand Up @@ -55,8 +55,9 @@ function handleSearch() {
})
})
}
document.addEventListener("DOMContentLoaded", function() {
document.addEventListener("click", function() {
// Get the button element by its ID
const button = document.getElementById("searchButton");
Expand Down