Skip to content

Commit

Permalink
Merge pull request #26 from Ant-Shell/fix/deploy-related-issues
Browse files Browse the repository at this point in the history
Fix: Deploy Related Issues
  • Loading branch information
Ant-Shell authored Apr 14, 2024
2 parents 1b0b670 + 09a5fa3 commit fbb092e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Image Match Game</title>
</head>
<body class="max-h-screen max-w-screen bg-cover bg-top"
<body class="max-h-screen max-w-screen bg-cover bg-top bg-no-repeat"
style="background-image: url(./src/assets/sebastian-unrau-sp-p7uuT0tw-unsplash.jpg)">
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
Expand Down
27 changes: 14 additions & 13 deletions src/utils/apiCalls.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
import { createClient, Photos } from 'pexels';

const API_KEY = import.meta.env.VITE_APP_API_KEY;
const client = createClient(API_KEY);

const getImages = async (): Promise<Photos> => {
const getImages = async () => {
try {
const response = await client.photos.curated({ per_page: 8 });
if ('photos' in response) {
return response as Photos;
} else {
const errorMessage = response
throw new Error(errorMessage.error);
const response = await fetch("https://api.pexels.com/v1/curated?per_page=8", {
headers: {
Authorization: API_KEY
}
})
if (!response.ok) {
throw new Error(response.statusText)
}
const data = await response.json()
return data

} catch (error) {
console.error("Failed to fetch curated photos:", error);
throw error;
console.log(error)
throw error
}
};
}

export { getImages };

0 comments on commit fbb092e

Please sign in to comment.