feat: initial commit — asaas-checkout template white-label
Template genérico de checkout com ASAAS, parametrizado via env vars. Inclui fluxo completo: checkout → pedido → polling → webhook → admin. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
25
components/auth-guard.tsx
Normal file
25
components/auth-guard.tsx
Normal file
@@ -0,0 +1,25 @@
|
||||
"use client"
|
||||
|
||||
import { useEffect } from "react"
|
||||
import { useRouter } from "next/navigation"
|
||||
import { useToast } from "@/components/ui/use-toast"
|
||||
import type React from "react" // Added import for React
|
||||
|
||||
export function AuthGuard({ children }: { children: React.ReactNode }) {
|
||||
const router = useRouter()
|
||||
const { toast } = useToast()
|
||||
|
||||
useEffect(() => {
|
||||
const isLoggedIn = localStorage.getItem("isLoggedIn")
|
||||
if (!isLoggedIn) {
|
||||
toast({
|
||||
title: "Acesso negado",
|
||||
description: "Faça login para acessar a área administrativa.",
|
||||
variant: "destructive",
|
||||
})
|
||||
router.push("/login")
|
||||
}
|
||||
}, [router, toast])
|
||||
|
||||
return <>{children}</>
|
||||
}
|
||||
Reference in New Issue
Block a user