keep-alive.js 343 B

1234567891011121314
  1. import $ from 'jquery';
  2. import { config } from 'grav-form';
  3. const keepAlive = $('[data-grav-keepalive]');
  4. if (keepAlive.length) {
  5. const timeout = config.session_timeout / 1.5 * 1000;
  6. setInterval(() => {
  7. $.ajax({
  8. url: `${config.base_url_relative}/task${config.param_sep}keep-alive`
  9. });
  10. }, timeout);
  11. }