feat(pwa): register service worker from Providers component
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect } from "react";
|
||||
import { ThemeProvider } from "next-themes";
|
||||
import { MotionConfig } from "framer-motion";
|
||||
import { CartProvider } from "@/context/CartContext";
|
||||
@@ -8,9 +9,13 @@ import SiteHeader from "@/components/layout/SiteHeader";
|
||||
import SiteFooter from "@/components/layout/SiteFooter";
|
||||
import CartToast from "@/components/storefront/CartToast";
|
||||
import CartRestoredToast from "@/components/cart/CartRestoredToast";
|
||||
import { registerServiceWorker } from "@/lib/pwa";
|
||||
|
||||
export function Providers({ children }: { children: React.ReactNode }) {
|
||||
const pathname = usePathname();
|
||||
useEffect(() => {
|
||||
registerServiceWorker();
|
||||
}, []);
|
||||
const isBrandRoute = pathname?.startsWith("/tuxedo") || pathname?.startsWith("/indian-river-direct");
|
||||
const isLandingPage = pathname === "/" || pathname === "/brands";
|
||||
const isAuthPage = pathname === "/login" || pathname === "/admin/login";
|
||||
|
||||
Reference in New Issue
Block a user