I have been using Google Calendars in Classic using DateSnap from Yabdab. This works quite well but I want to replicate the functionality in Elements.
I used AI to provide some code which works to a point. It references script.js which I inserted into the Javascript section.
I set up the API in Google and I am using the key.
I get an error ‘Error fetching events: undefined‘.
Has anyone had experience in setting up a calendar in Elements? Ideally I would like to replicate what DateSnap does as it allows for a list view for a month, a day and week view.
I found a couple of issues with your Custom Component.
The template is including some HTML elements that should be in the <head> area of the page, you can fix this with an @portal(headEnd)statement.
The Google API is returning an 403 Permission Denied response, with the message Requests from referer http://127.0.0.1 are blocked.
The error means that your API key is not setup to allow requests from your local machine, you might be able to fix this in the settings on your Google Account. Otherwise it should work when publishing the site to your domain.
Here’s the updated template code for your custom component, note the use of the @portal at the top:
Thank you for that. I am still getting an undefined error. I will investigate further to see if I can find the reason for that. I also took off the restriction for the website so I can test it without having to upload it each time.