Fix FamilyProvider admin check - move inside useEffect
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
70376d2e96
commit
e7539468c1
1 changed files with 7 additions and 6 deletions
|
|
@ -49,13 +49,14 @@ export function FamilyProvider({ children: providerChildren }: { children: React
|
|||
const [memberCount, setMemberCount] = useState(2);
|
||||
|
||||
useEffect(() => {
|
||||
async function fetchFamilyData() {
|
||||
// Skip family check for admin pages
|
||||
if (typeof window !== "undefined" && window.location.pathname.startsWith("/admin")) {
|
||||
const path = window.location.pathname;
|
||||
if (path.startsWith("/admin") || path === "/admin-login") {
|
||||
setLoading(false);
|
||||
return;
|
||||
}
|
||||
|
||||
async function fetchFamilyData() {
|
||||
try {
|
||||
// Get current session from database
|
||||
const sessionRes = await fetch("/api/auth/signin");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue