Sha256: 19429110d4e1dd8f7ca6a3bb39438515f3dfa3f08f1e1dcdda525229efa02f12

Contents?: true

Size: 1.1 KB

Versions: 117

Compression:

Stored size: 1.1 KB

Contents

/*
// Custom JS | written by https://github.com/wdzajicek for,
// © 2020 Kankakee Community College
// =================================================== */
// Modules' default function stores our Google Sheet response in sessionStorage to be retrieved later
// Each key gets set to a column in our data
// Each key's value gets set to the corresponding cell in the row below
// ====================================================================
function cacheResponse(response) { // response from Google API's spreadsheet.values.get() method
  const VALUES = response.result.values; // This is where the table's data is in a Sheets response in Sheets API V4
  const TABLE_HEADER_ROW = VALUES[1]; // 2nd row in the sheet (first row is instructions to the user)
  const TABLE_BODY_ROW = VALUES[2]; // The only row of data in our table
  
  for (let i = 0, len = TABLE_BODY_ROW.length; i < len; i++ ) {
    const cell = TABLE_BODY_ROW[i];
    const column = TABLE_HEADER_ROW[i];

    window.sessionStorage.setItem(column.replace(/\s/g, '-'), cell);
  }
  //window.sessionStorage.clear();
}

export default cacheResponse;

Version data entries

117 entries across 117 versions & 2 rubygems

Version Path
kcc-gem-theme-3.11.4 assets/js/alerts/cacheResponse.js
kcc-gem-theme-3.11.3 assets/js/alerts/cacheResponse.js
kcc-gem-theme-3.11.1 assets/js/alerts/cacheResponse.js
kcc-gem-theme-3.11.0 assets/js/alerts/cacheResponse.js
kcc-gem-theme-3.10.7 assets/js/alerts/cacheResponse.js
kcc-gem-theme-3.10.6 assets/js/alerts/cacheResponse.js
kcc-gem-theme-3.10.5 assets/js/alerts/cacheResponse.js
kcc-gem-theme-3.10.4 assets/js/alerts/cacheResponse.js
kcc-gem-theme-3.10.3 assets/js/alerts/cacheResponse.js
kcc-gem-theme-3.10.2 assets/js/alerts/cacheResponse.js
kcc-gem-theme-3.10.1 assets/js/alerts/cacheResponse.js
kcc-gem-theme-3.10.0 assets/js/alerts/cacheResponse.js
kcc-gem-theme-3.9.4 assets/js/alerts/cacheResponse.js
kcc-gem-theme-3.9.3 assets/js/alerts/cacheResponse.js
kcc-gem-theme-3.9.2 assets/js/alerts/cacheResponse.js
kcc-gem-theme-3.9.1 assets/js/alerts/cacheResponse.js
kcc-gem-theme-3.9.0 assets/js/alerts/cacheResponse.js
kcc-gem-theme-3.8.0 assets/js/alerts/cacheResponse.js
kcc-gem-theme-3.7.10 assets/js/alerts/cacheResponse.js
kcc-gem-theme-3.7.9 assets/js/alerts/cacheResponse.js