Skip to content

Commit

Permalink
set the value of litcal_events to the actual litcal_events object
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnRDOrazio committed Oct 16, 2024
1 parent 88d204e commit 9d24d13
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,12 @@
<?php
if ($apiVersion === 'dev' || $apiVersion === 'v4') {
$eventsEndpoint = "https://litcal.johnromanodorazio.com/api/dev/events";
$eventsRaw = file_get_contents("$eventsEndpoint?locale=" . $i18n->locale);
if ($eventsRaw === false) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $eventsEndpoint);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Accept-Language: " . $i18n->locale]);
$eventsRaw = curl_exec($ch);
if (curl_errno($ch)) {
die('Could not fetch data from ' . $eventsEndpoint);
}
[ "litcal_events" => $LitCalAllFestivities ] = json_decode(
Expand Down Expand Up @@ -182,6 +186,7 @@ class="bi bi-exclamation-triangle-fill flex-shrink-0 me-2" viewBox="0 0 16 16"
</div>
<?php
$testsIndex = json_encode($LitCalTests);
echo "<script>const LitCalTests = Object.freeze($testsIndex); let litcal_events = Object.freeze($eventsRaw);</script>";
$litcal_events = json_encode($LitCalAllFestivities);
echo "<script>const LitCalTests = Object.freeze($testsIndex); let litcal_events = Object.freeze($litcal_events);</script>";
include_once 'layout/footer.php';
?>

0 comments on commit 9d24d13

Please sign in to comment.