'use client' import React, { useEffect, useState } from 'react' import PricingCard from './PricingCard' import { PricingCardProps } from '@/app/types' import useUserStore from '@/app/store/userStore' import Loader from '@/components/ui/Loader' const AdminPayments = () => { const { user } = useUserStore() const [plans, setPlans] = useState([]) const [isLoading, setIsLoading] = useState(true) const [error, setError] = useState(null) useEffect(() => { const fetchPlans = async () => { try { const response = await fetch('/api/account/get-plans') if (!response.ok) { throw new Error('Failed to fetch plans') } const data = await response.json() setPlans(data) } catch (err) { setError(err instanceof Error ? err.message : 'Failed to load pricing plans') } finally { setIsLoading(false) } } fetchPlans() }, []) if (isLoading) { return } if (error) { return
{error}
} return (

Тарифные планы

{plans.map(plan => ( ))}
) } export default AdminPayments