Add debug logging to FamilyProvider
Move admin check to top-level useEffect before any async calls. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
e7539468c1
commit
754a602e48
1 changed files with 8 additions and 7 deletions
|
|
@ -49,14 +49,15 @@ export function FamilyProvider({ children: providerChildren }: { children: React
|
||||||
const [memberCount, setMemberCount] = useState(2);
|
const [memberCount, setMemberCount] = useState(2);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function fetchFamilyData() {
|
|
||||||
// Skip family check for admin pages
|
|
||||||
const path = window.location.pathname;
|
const path = window.location.pathname;
|
||||||
|
console.log("FamilyProvider: checking path =", path);
|
||||||
if (path.startsWith("/admin") || path === "/admin-login") {
|
if (path.startsWith("/admin") || path === "/admin-login") {
|
||||||
|
console.log("FamilyProvider: skipping for admin page");
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function fetchFamilyData() {
|
||||||
try {
|
try {
|
||||||
// Get current session from database
|
// Get current session from database
|
||||||
const sessionRes = await fetch("/api/auth/signin");
|
const sessionRes = await fetch("/api/auth/signin");
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue