Skip to content

Commit

Permalink
updating the expiration/redirection on the client side
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeCodes19 committed Feb 28, 2025
1 parent ab73c43 commit 7cc79b6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions app/app/javascript/controllers/session_controller.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Controller } from "@hotwired/stimulus";

import { getDocumentLocale } from "../utilities/getDocumentLocale";
export default class extends Controller {
static targets = [
"modal",
Expand All @@ -12,9 +12,10 @@ export default class extends Controller {

connect() {
console.log("Session controller connected");
// if the element is not the modal target, return because it does not have the data we need

// if the element is not the modal target, return because only the modal target
// has the data we need
if(!this.hasModalTarget) {
console.log("No modal target found for this controller instance");
return;
}

Expand All @@ -36,7 +37,8 @@ export default class extends Controller {

// Set timer for the actual session expiration
this.expirationTimer = setTimeout(() => {
this.endSession(false);
const locale = getDocumentLocale();
window.location = `/${locale}/cbv/entry?end_session=true&user_action=false`;
}, expirationDelay);
}

Expand Down

0 comments on commit 7cc79b6

Please sign in to comment.