"use client"; import React, { useEffect, useState } from "react"; import PriceCard from "@/components/PriceCard"; import PriceToggle from "@/components/PriceToggle"; import { apiPrices } from "../app/(public)/pricing/action"; const Payment = ({ type = "one_time", }) => { const [isAnnual, setIsAnnual] = useState(false); const [products, setProducts] = useState([]); const [isLoading, setIsLoading] = useState(true); const handleToggle = () => { setIsAnnual((prev) => !prev); }; useEffect(() => { setIsLoading(true); (async () => { const resposeProducts = await apiPrices(); setProducts(resposeProducts); setIsLoading(false); })(); }, []); return ( <> {!(type == "one_time") && (
)}
{isLoading ? ( <> ) : ( (products || []) .filter((x) => type == "one_time" ? x.type == "one_time" : x.type != "one_time" ) .map((x, i) => ( )) )}
); }; export default Payment;