From 727e5cb19933576525a2235445d8b94cbffd1480 Mon Sep 17 00:00:00 2001 From: Sli Date: Wed, 4 Sep 2024 16:59:04 +0200 Subject: [PATCH] Dummy data on default current_picture to avoid javascript errors --- sas/static/sas/js/picture.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/sas/static/sas/js/picture.js b/sas/static/sas/js/picture.js index 3a93ff5e..0b1f714c 100644 --- a/sas/static/sas/js/picture.js +++ b/sas/static/sas/js/picture.js @@ -19,9 +19,21 @@ document.addEventListener("alpine:init", () => { identifications: [], /** * The currently displayed picture + * Default dummy data are pre-loaded to avoid javascript error + * when loading the page at the beginning * @type Picture **/ - current_picture: undefined, + current_picture: { + is_moderated: true, + id: null, + name: "", + display_name: "", + compressed_url: "", + profile_url: "", + full_size_url: "", + owner: "", + date: new Date(), + }, /** * The picture which will be displayed next if the user press the "next" button * @type ?Picture