Skip to content

Commit

Permalink
MOL-438/MOL-459: missing code
Browse files Browse the repository at this point in the history
  • Loading branch information
tdang1-shopmacher committed Oct 7, 2024
1 parent 2a5e976 commit 79bbaa1
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,19 @@ const getMethods = async (targetUrl?: string) => {

export const usePaymentMethodsFetcher = (url: string | undefined) => {
const [fetchedData, setFetchedData] = useState<CustomMethodObject[]>([]);
const [fetchedDataLoading, setFetchedDataLoading] = useState<boolean>(true);

useEffect(() => {
const fetchData = async () => {
const data = (await getMethods(url)) ?? [];
setFetchedData(data);
setFetchedDataLoading(false);
};

if (url) {
fetchData();
}
}, [url]);

return fetchedData;
return { fetchedData, fetchedDataLoading };
};

0 comments on commit 79bbaa1

Please sign in to comment.