From 67b500e6266fc6b6bf272afc24c7fb738b575fd3 Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Tue, 15 Mar 2022 01:31:26 +0000 Subject: [PATCH] Ensure member stops PayPal before pausing --- webclient/src/AdminMembers.js | 53 ++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/webclient/src/AdminMembers.js b/webclient/src/AdminMembers.js index 77ff5c2..ae3b033 100644 --- a/webclient/src/AdminMembers.js +++ b/webclient/src/AdminMembers.js @@ -314,7 +314,7 @@ export function AdminMemberPause(props) { const [error, setError] = useState(false); const [loading, setLoading] = useState(false); const [success, setSuccess] = useState(false); - const [yousure, setYousure] = useState(false); + const [told, setTold] = useState(false); const { id } = useParams(); useEffect(() => { @@ -322,25 +322,20 @@ export function AdminMemberPause(props) { }, [result.member]); const handlePause = (e) => { - if (yousure) { - if (loading) return; - setLoading(true); - setSuccess(false); - requester('/members/' + id + '/pause/', 'POST', token, {}) - .then(res => { - setYousure(false); - setSuccess(true); - setError(false); - refreshResult(); - }) - .catch(err => { - setLoading(false); - console.log(err); - setError(true); - }); - } else { - setYousure(true); - } + if (loading) return; + setLoading(true); + setSuccess(false); + requester('/members/' + id + '/pause/', 'POST', token, {}) + .then(res => { + setSuccess(true); + setError(false); + refreshResult(); + }) + .catch(err => { + setLoading(false); + console.log(err); + setError(true); + }); }; const handleUnpause = (e) => { @@ -372,9 +367,21 @@ export function AdminMemberPause(props) { Unpause : - + <> +

+ setTold(v.checked)} + /> +

+ + + }