99382db720
Gate Turbo.offline.start() behind Current.user so the service worker is only registered for authenticated users. This avoids errors on unauthenticated pages where /service-worker.js requires auth. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
10 lines
180 B
JavaScript
10 lines
180 B
JavaScript
import { Turbo } from "@hotwired/turbo-rails"
|
|
|
|
if (Current.user) {
|
|
Turbo.offline.start("/service-worker.js", {
|
|
scope: "/",
|
|
native: true,
|
|
preload: /\/assets\//
|
|
})
|
|
}
|