Commit 8e81b972 by G

- state for browser openning state

- export mutation handler for request retrieving payment url
parent 3559b180
...@@ -17,15 +17,16 @@ const useOrangeMoney = () => { ...@@ -17,15 +17,16 @@ const useOrangeMoney = () => {
const [isBrowserOpen, setIsBrowserOpen] = useState(false); const [isBrowserOpen, setIsBrowserOpen] = useState(false);
const handlePaymentUsingBrowser = async (url: string) => { const handlePaymentUsingBrowser = async (url: string) => {
setIsBrowserOpen(true);
const result = await WebBrowser.openBrowserAsync(url); const result = await WebBrowser.openBrowserAsync(url);
// setResult(result); // setResult(result);
console.log("result", result); console.log("result", result);
setIsBrowserOpen(false);
}; };
const omPaymentMutation = useMutation({ const { isPending, mutate } = useMutation({
mutationFn: (amount: number) => mutationFn: (amount: number) =>
getTransactionsData({ getTransactionsData({
// biome-ignore lint/style/useNamingConvention: <explanation>
...paymentObjectDefault, ...paymentObjectDefault,
montant: amount, montant: amount,
}), }),
...@@ -38,7 +39,7 @@ const useOrangeMoney = () => { ...@@ -38,7 +39,7 @@ const useOrangeMoney = () => {
}, },
}); });
return { omPaymentMutation, isBrowserOpen }; return { getOmPaymentUrl: mutate, isBrowserOpen, isWaitingForOmPaymentUrl: isPending };
}; };
export default useOrangeMoney; export default useOrangeMoney;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment