import axios from "axios";
import { useEffect, useState } from "react";
import { PaymentsStatus } from "@/interfaces/user.payments";

export default function usePaymentStatusUsers() {
  const [{ pending, done }, setStatus] = useState<PaymentsStatus>({
    pending: [],
    done: [],
  });

  const getData = () => {
    axios.get<PaymentsStatus>("/api/payments/assigned").then((response) => {
      setStatus(response.data);
    });
  };

  useEffect(getData, []);

  return { pending, done };
}
