Added payment done and pending
This commit is contained in:
20
src/hooks/usePaymentStatusUsers.tsx
Normal file
20
src/hooks/usePaymentStatusUsers.tsx
Normal file
@@ -0,0 +1,20 @@
|
||||
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 };
|
||||
}
|
||||
Reference in New Issue
Block a user