Files
fizzy/app/javascript/controllers/clear_offline_cache_controller.js
T
Rosa Gutierrez 1c2de6ca79 Clear offline cache on sign-in as well as sign-out
Rename logout controller to clear-offline-cache and attach it to the
magic link verification form so the service worker cache is cleared
when a different user signs in.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 10:20:54 +01:00

9 lines
246 B
JavaScript

import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
async clearCache() {
const registration = await navigator.serviceWorker?.ready
registration?.active?.postMessage({ action: "clearCache" })
}
}