I use Google Calendar to write the itinerary according to the document, and it can be added to the calendar normally on the project, but it will prompt Uncaught ReferenceError: appendPre is not defined. Does anyone know why this is
enter image description hereenter image description here
I tried writing according to the document, but it still didn’t work
var event = {
‘summary’: ‘DCH Toolbox – Repair Appointment ‘+this.arr?.serviceDate.slice(8,10)+’/’+this.arr?.serviceDate.slice(5,7)+’/’+this.arr?.serviceDate.slice(0,4),
‘location’: address,
‘description’: ‘Repair appointment Ref. code: ‘+this.arr.serviceOrderId+’ has been confirmed.’,
‘start’: {
‘date’: this.arr?.serviceDate
},
‘end’: {
‘date’: this.arr?.serviceDate
},
‘attendees’: [
{’email’: this.arr.logisticsElectronicAddressLocatorEmail}
],
‘reminders’: {
‘useDefault’: false,
‘overrides’: [
{‘method’: ’email’, ‘minutes’: 24 * 60},
{‘method’: ‘popup’, ‘minutes’: 10}
]
}
};
tokenClient = google.accounts.oauth2.initTokenClient({
client_id: clientId,
scope: ‘https://www.googleapis.com/auth/calendar’,
callback: ”, // defined later
});
gisInited = true;
tokenClient.callback = async (resp) => {
if (resp.error !== undefined) {
throw (resp);
}
console.log(‘gapi.client’,gapi.client);
if(gapi.client.calendar) {
var request = gapi.client.calendar.events.insert({
‘calendarId’: ‘primary’,
‘resource’: event
});
console.log(‘request’,request);
await request.execute(function(event2) {
appendPre(‘Event created: ‘ + event2.htmlLink);
});
}
};
rick rick is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.