Skip to content

Commit

Permalink
serve content from workers
Browse files Browse the repository at this point in the history
  • Loading branch information
letioneill committed Jun 21, 2024
1 parent 3d686df commit af08290
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion components/api.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// The API Endpoint
let endpoint = 'https://web-apps-serverless.letioneill.workers.dev';

/**
* Save photos to session storage
* @param {Array} photos The photo date
Expand Down Expand Up @@ -27,7 +30,7 @@ async function getPhotos() {

// Otherwise, fetch fresh data from the API
try {
let response = await fetch("https://vanillajsacademy.com/api/photos.json");
let response = await fetch(endpoint);
if (!response.ok) throw response;
let photos = await response.json();
savePhotos(photos);
Expand Down

0 comments on commit af08290

Please sign in to comment.