[call-me] - improvements

This commit is contained in:
Miroslav Pejic
2024-11-26 22:37:28 +01:00
parent 3825333201
commit fbaab2fd95
2 changed files with 15 additions and 2 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "call-me",
"version": "1.0.19",
"version": "1.0.20",
"description": "Your Go-To for Instant Video Calls",
"author": "Miroslav Pejic - miroslav.pejic.85@gmail.com",
"license": "AGPLv3",
+14 -1
View File
@@ -42,10 +42,23 @@ document.addEventListener('DOMContentLoaded', async function () {
// Get Random Images
async function fetchRandomImage() {
if (sessionStorage.cachedImage) {
// If there's cached data, use it
randomImage.src = sessionStorage.cachedImage;
console.log('Using cached image');
return;
}
try {
const response = await axios.get('/randomImage');
const data = response.data;
randomImage.src = data.urls.regular;
// Cache the image URL for subsequent calls
sessionStorage.cachedImage = data.urls.regular;
// Update the image source
randomImage.src = sessionStorage.cachedImage;
console.log('Fetched and cached image');
} catch (error) {
console.error('Error fetching image', error.message);
}