assets/js/theme/alerts/campusAlertsSheetsAPI.js in kcc-gem-theme-1.71.76 vs assets/js/theme/alerts/campusAlertsSheetsAPI.js in kcc-gem-theme-1.72.76
- old
+ new
@@ -15,28 +15,26 @@
const SHEET_KEY = '1plXBiZY5pVbhNT-mszxEuqCl4zy8wMnz9gXXbbT_yLs';
const SHEET_TAB_NAME = 'Alerts';
const EMERGENCY_ALERT_DIV_ID = 'emergencyAlerts'
const SHEET_PARAMS = setSheetParameters(SHEET_KEY, SHEET_TAB_NAME);
-const PARAMS = { // This is configuration for API call with spreadsheets that are setup as readonly
+const API_PARAMS = { // This is configuration for API call with spreadsheets that are setup as readonly
'apiKey': 'AIzaSyCEBsbXfFcdbkASlg-PodD1rT_Fe3Nw62A',
'discoveryDocs': ['https://www.googleapis.com/discovery/v1/apis/sheets/v4/rest']
};
function init() {
- gapi.client.init(PARAMS).then(function() { // Executes an API request, and returns a Promise.
+ gapi.client.init(API_PARAMS).then(() => { // Executes an API request, and returns a Promise.
return gapi.client.sheets.spreadsheets.values.get(SHEET_PARAMS)
- .then((response) => {
- createAlertsHtml(response); // Build the html & inject it into the DOM
- return response;
- }).then((response) => {
- makeTabsLinkable(); // Handle hash & query URI's to target accordion and tabbed-nav content
- cacheResponse(response); // Cache the Google API response for subsequent page loads in the site
- },
- function(err) {
- console.error("Execute error", err);
- makeTabsLinkable();
- });
+ }).then((response) => {
+ createAlertsHtml(response); // Build the html & inject it into the DOM
+ return response;
+ }).then((response) => {
+ makeTabsLinkable(); // Handle hash & query URI's to target accordion and tabbed-nav content
+ cacheResponse(response); // Cache the Google API response for subsequent page loads in the site
+ }, (err)=> {
+ console.error("Execute error", err);
+ makeTabsLinkable();
});
}
function start() {
if ( ! document.getElementById(EMERGENCY_ALERT_DIV_ID) )