import { Controller } from "@hotwired/stimulus"

export default class extends Controller {
  connect() {
   // Optionally handle Turbo navigation events
    //
  } 
  
  disconnect() {
    //document.removeEventListener("turbo:before-fetch-request", this.handleTurboNavigation);
  }

  handleTurboNavigation() {
    console.log('Back button was pressed.');

    // if (this.sheetOpen) {
    //   this.closeSheet()
    //   history.pushState(null, '', document.URL);
    // }
    history.pushState(null, '', document.URL);
  }
};
