Sha256: 7ec585291f9f6d357224cb6500c92714a30fc5a076a6289bf919b8f28a7fd89d

Contents?: true

Size: 712 Bytes

Versions: 6

Compression:

Stored size: 712 Bytes

Contents

import dayjs from "dayjs"

$(() => {
  const $impersonationWarning = $("[data-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

6 entries across 6 versions & 1 rubygems

Version Path
decidim-core-0.29.1 app/packs/src/decidim/impersonation.js
decidim-core-0.29.0 app/packs/src/decidim/impersonation.js
decidim-core-0.29.0.rc4 app/packs/src/decidim/impersonation.js
decidim-core-0.29.0.rc3 app/packs/src/decidim/impersonation.js
decidim-core-0.29.0.rc2 app/packs/src/decidim/impersonation.js
decidim-core-0.29.0.rc1 app/packs/src/decidim/impersonation.js