Commit 332be478 authored by Tobias Zeumer's avatar Tobias Zeumer
Browse files

Slightly easier to use JS version

parent e4b13bf7
Loading
Loading
Loading
Loading
+3 −1
Changes for rest-js/index.html: 3 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -4,9 +4,11 @@
    <title>FOLIO-Abfragen TUHH</title>
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <link rel="stylesheet" href="css/style.css">
    <!-- Download from https://github.com/koalyptus/TableFilter -->
    <script src="../vendor/koalyptus/tablefilter/dist/tablefilter/tablefilter.js"></script>
    <!-- script src="https://cdn.jsdelivr.net/npm/tablefilter@0.7.2/dist/tablefilter/tablefilter.min.js"></script -->
    <script src="js/folio_api.js"></script>
<body id="preset_token" data-token="">
<body id="preset_token" data-token="" data-tenant="">

<div id="container">
    <h1>FOLIO-Abfragen TUHH (Javascript)</h1>
+12 −4
Changes for rest-js/js/folio_api.js: 12 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -6,10 +6,10 @@
var cfg_user    = 'tub_api';
var cfg_pass    = '';
var cfg_host    = 'https://okapi.gbv.de';
var cfg_tenant  = 'tuhh';
var cfg_tenant  = '';

var folio_token     = '';
var folio_refresh   = '';
//var folio_refresh   = '';

var result_limit = 100;

@@ -22,12 +22,20 @@ var fadeIntervalID = 0;
window.addEventListener("load", function windowLoad () {
    var reponse_html = document.getElementById('reponse_html');

    // Provide token via element with id 'preset_token'. Otherwise fetch using user + password
    // Provide token via folio_token variable at file start or via element with id 'preset_token'. 
    if (folio_token == '') {
        folio_token = document.querySelector('#preset_token').dataset.token;
    if (folio_token == undefined) {
    }
    // If folio_token is not provided by either source fetch it using cfg_user + cfg_passhost)
    if (folio_token == '') {
        get_token();    
    }

    // Set tenant name via cfg_tenant variable at file start or via element with id 'preset_token'. 
    if (folio_token == '') {
        cfg_tenant = document.querySelector('#preset_token').dataset.tenant;
    }

    /**
     * EventListen: Click
     */