feat: initialize Prisma schema and scaffold core application modules including auth, blogs, events, and business directories
Some checks failed
Build and Push App / build (push) Failing after 47s
Some checks failed
Build and Push App / build (push) Failing after 47s
This commit is contained in:
@@ -6,6 +6,7 @@ import { useRouter, usePathname } from 'next/navigation';
|
||||
|
||||
interface UserContextType {
|
||||
user: User | null;
|
||||
settings: any | null;
|
||||
login: (user: User) => void;
|
||||
logout: () => void;
|
||||
}
|
||||
@@ -14,6 +15,7 @@ const UserContext = createContext<UserContextType | undefined>(undefined);
|
||||
|
||||
export function UserProvider({ children }: { children: ReactNode }) {
|
||||
const [user, setUser] = useState<User | null>(null);
|
||||
const [settings, setSettings] = useState<any>(null);
|
||||
const router = useRouter();
|
||||
const pathname = usePathname();
|
||||
|
||||
@@ -22,6 +24,12 @@ export function UserProvider({ children }: { children: ReactNode }) {
|
||||
if (savedUser) {
|
||||
setUser(JSON.parse(savedUser));
|
||||
}
|
||||
|
||||
// Fetch settings
|
||||
fetch('/api/settings')
|
||||
.then(res => res.json())
|
||||
.then(data => setSettings(data))
|
||||
.catch(err => console.error('Error fetching settings:', err));
|
||||
}, []);
|
||||
|
||||
// Global suspension check
|
||||
@@ -42,7 +50,7 @@ export function UserProvider({ children }: { children: ReactNode }) {
|
||||
};
|
||||
|
||||
return (
|
||||
<UserContext.Provider value={{ user, login, logout }}>
|
||||
<UserContext.Provider value={{ user, settings, login, logout }}>
|
||||
{children}
|
||||
</UserContext.Provider>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user