Sha256: 938931aa0687b951682801ca1d87641bb9cea6c825c3f3ae1ee10201fb63c03b

Contents?: true

Size: 706 Bytes

Versions: 19

Compression:

Stored size: 706 Bytes

Contents

import dayjs from "dayjs"

$(() => {
  const $impersonationWarning = $(".impersonation-warning");
  if ($impersonationWarning.length) {
    const endsAt = dayjs($impersonationWarning.data("session-ends-at"));
    const exitInterval = setInterval(() => {
      const diff = (endsAt - dayjs()) / 60000;
      const diffInMinutes = Math.round(diff);
      $impersonationWarning.find(".minutes").html(diffInMinutes);

      if (diff <= 0) {
        window.location.reload();
      }
    }, 1000);

    // Prevent reload when page is already unloading, otherwise it may cause infinite reloads.
    window.addEventListener("beforeunload", () => {
      clearInterval(exitInterval);
      return;
    });
  }
});

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
decidim-core-0.28.4 app/packs/src/decidim/impersonation.js
decidim-core-0.27.9 app/packs/src/decidim/impersonation.js
decidim-core-0.28.3 app/packs/src/decidim/impersonation.js
decidim-core-0.27.8 app/packs/src/decidim/impersonation.js
decidim-core-0.28.2 app/packs/src/decidim/impersonation.js
decidim-core-0.27.7 app/packs/src/decidim/impersonation.js
decidim-core-0.28.1 app/packs/src/decidim/impersonation.js
decidim-core-0.27.6 app/packs/src/decidim/impersonation.js
decidim-core-0.28.0 app/packs/src/decidim/impersonation.js
decidim-core-0.27.5 app/packs/src/decidim/impersonation.js
decidim-core-0.28.0.rc5 app/packs/src/decidim/impersonation.js
decidim-core-0.28.0.rc4 app/packs/src/decidim/impersonation.js
decidim-core-0.27.4 app/packs/src/decidim/impersonation.js
decidim-core-0.27.3 app/packs/src/decidim/impersonation.js
decidim-core-0.27.2 app/packs/src/decidim/impersonation.js
decidim-core-0.27.1 app/packs/src/decidim/impersonation.js
decidim-core-0.27.0 app/packs/src/decidim/impersonation.js
decidim-core-0.27.0.rc2 app/packs/src/decidim/impersonation.js
decidim-core-0.27.0.rc1 app/packs/src/decidim/impersonation.js