keep-alive.js 406 B

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