update fetch calls in frontend
This commit is contained in:
parent
319f83afaf
commit
0b6d992a71
|
@ -87,7 +87,7 @@ function formatTime(date) {
|
|||
|
||||
async function fetchAllEvents() {
|
||||
console.log("fetching events");
|
||||
const response = await fetch('http://localhost:8080/api/events');
|
||||
const response = await fetch('/api/events');
|
||||
const allEvents = await response.json();
|
||||
|
||||
const resourcesContainer = document.getElementById('resources-container');
|
||||
|
@ -128,7 +128,7 @@ function updateFontSize(elementId) {
|
|||
async function fetchAndDisplayQuote() {
|
||||
try {
|
||||
// Update the endpoint if you created a new one
|
||||
const response = await fetch('http://localhost:8080/api/quotes'); // or '/api/quotes/random'
|
||||
const response = await fetch('/api/quotes'); // or '/api/quotes/random'
|
||||
|
||||
if (response.ok) {
|
||||
const randomQuote = await response.json();
|
||||
|
@ -161,7 +161,7 @@ function displayDefaultQuote() {
|
|||
|
||||
// Fetch Current Weather
|
||||
async function fetchWeather() {
|
||||
const response = await fetch('http://localhost:8080/api/weather');
|
||||
const response = await fetch('/api/weather');
|
||||
const data = await response.json();
|
||||
if (data.cod === 200) {
|
||||
const temperature = data.main.temp;
|
||||
|
@ -190,7 +190,7 @@ function displayTime() {
|
|||
|
||||
async function fetchSlideshowImages() {
|
||||
try {
|
||||
const response = await fetch('http://localhost:8080/api/slideshow');
|
||||
const response = await fetch('/api/slideshow');
|
||||
if (!response.ok) {
|
||||
throw new Error('Failed to fetch slideshow images');
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ async function fetchSlideshowImages() {
|
|||
function createSlideshowElement(src) {
|
||||
const img = document.createElement('img');
|
||||
// img.src = src;
|
||||
img.src = `http://localhost:8080${src}`;
|
||||
img.src = `${src}`;
|
||||
img.className = 'slideshow-img';
|
||||
img.style.width = '100%';
|
||||
img.style.maxHeight = '100vh';
|
||||
|
|
1
public/assets/index--Q5o5huW.js
Normal file
1
public/assets/index--Q5o5huW.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user