-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New main branch to deal w/ reversion issues
- Loading branch information
1 parent
716fb5b
commit 302f5b8
Showing
2,613 changed files
with
507,522 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
async function register() { | ||
const email = document.getElementById("email").value; | ||
const username = document.getElementById("username").value; | ||
const password = document.getElementById("password").value; | ||
const response = await fetch("/register", { | ||
method: "POST", | ||
headers: { "Content-Type": "application/json" }, | ||
body: JSON.stringify({ email, username, password }), | ||
}); | ||
const data = await response.json(); | ||
console.log(JSON.stringify(data, null, 2)); | ||
alert(data.message); | ||
} | ||
|
||
async function login() { | ||
const username = document.getElementById("username").value; | ||
const password = document.getElementById("password").value; | ||
const response = await fetch("/login", { | ||
method: "POST", | ||
headers: { "Content-Type": "application/json" }, | ||
body: JSON.stringify({ username, password }), | ||
}); | ||
const data = await response.json(); | ||
console.log(JSON.stringify(data, null, 2)); | ||
alert(data.message); | ||
} | ||
|
||
async function logout() { | ||
const response = await fetch("/logout"); | ||
const data = await response.json(); | ||
console.log(JSON.stringify(data, null, 2)); | ||
alert(data.message); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,34 @@ | ||
const tags = document.querySelectorAll('.tag'); | ||
const tags = document.querySelectorAll(".tag"); | ||
|
||
tags.forEach(tag => { | ||
tag.addEventListener('click', () => { | ||
const genre = tag.getAttribute('data-genre'); | ||
tags.forEach((tag) => { | ||
tag.addEventListener("click", () => { | ||
const genre = tag.getAttribute("data-genre"); | ||
|
||
tags.forEach(t => t.classList.remove('active')); | ||
tag.classList.add('active'); | ||
tags.forEach((t) => t.classList.remove("active")); | ||
tag.classList.add("active"); | ||
|
||
fetch(`http://127.0.0.1:4000/events/search?genre=${encodeURIComponent(genre)}`) //fetch events filtered by selected tag | ||
.then(response => { | ||
fetch( | ||
`http://127.0.0.1:4000/events/search?genre=${encodeURIComponent(genre)}` | ||
) //fetch events filtered by selected tag | ||
.then((response) => { | ||
if (!response.ok) { | ||
throw new Error('Failed to fetch events'); | ||
throw new Error("Failed to fetch events"); | ||
} | ||
return response.json(); | ||
}) | ||
.then(events => { | ||
const eventsContainer = document.querySelector('.events'); | ||
eventsContainer.innerHTML = ''; //clear existing events | ||
.then((events) => { | ||
const eventsContainer = document.querySelector(".events"); | ||
eventsContainer.innerHTML = ""; //clear existing events | ||
|
||
events.forEach(event => { | ||
const eventElement = document.createElement('div'); | ||
eventElement.classList.add('event'); | ||
events.forEach((event) => { | ||
const eventElement = document.createElement("div"); | ||
eventElement.classList.add("event"); | ||
eventElement.textContent = event.name; | ||
eventsContainer.appendChild(eventElement); | ||
}); | ||
}) | ||
.catch(error => { | ||
console.error('Error fetching events:', error); | ||
.catch((error) => { | ||
console.error("Error fetching events:", error); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.