Ensure member stops PayPal before pausing
This commit is contained in:
parent
39fde2cefc
commit
67b500e626
|
@ -314,7 +314,7 @@ export function AdminMemberPause(props) {
|
||||||
const [error, setError] = useState(false);
|
const [error, setError] = useState(false);
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [success, setSuccess] = useState(false);
|
const [success, setSuccess] = useState(false);
|
||||||
const [yousure, setYousure] = useState(false);
|
const [told, setTold] = useState(false);
|
||||||
const { id } = useParams();
|
const { id } = useParams();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -322,25 +322,20 @@ export function AdminMemberPause(props) {
|
||||||
}, [result.member]);
|
}, [result.member]);
|
||||||
|
|
||||||
const handlePause = (e) => {
|
const handlePause = (e) => {
|
||||||
if (yousure) {
|
if (loading) return;
|
||||||
if (loading) return;
|
setLoading(true);
|
||||||
setLoading(true);
|
setSuccess(false);
|
||||||
setSuccess(false);
|
requester('/members/' + id + '/pause/', 'POST', token, {})
|
||||||
requester('/members/' + id + '/pause/', 'POST', token, {})
|
.then(res => {
|
||||||
.then(res => {
|
setSuccess(true);
|
||||||
setYousure(false);
|
setError(false);
|
||||||
setSuccess(true);
|
refreshResult();
|
||||||
setError(false);
|
})
|
||||||
refreshResult();
|
.catch(err => {
|
||||||
})
|
setLoading(false);
|
||||||
.catch(err => {
|
console.log(err);
|
||||||
setLoading(false);
|
setError(true);
|
||||||
console.log(err);
|
});
|
||||||
setError(true);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
setYousure(true);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleUnpause = (e) => {
|
const handleUnpause = (e) => {
|
||||||
|
@ -372,9 +367,21 @@ export function AdminMemberPause(props) {
|
||||||
Unpause
|
Unpause
|
||||||
</Button>
|
</Button>
|
||||||
:
|
:
|
||||||
<Button onClick={handlePause} loading={loading}>
|
<>
|
||||||
{yousure ? 'You Sure?' : 'Pause'}
|
<p>
|
||||||
</Button>
|
<Form.Checkbox
|
||||||
|
name='told_subscriptions'
|
||||||
|
value={told}
|
||||||
|
label='Told member to stop any PayPal subscriptions'
|
||||||
|
required
|
||||||
|
onChange={(e, v) => setTold(v.checked)}
|
||||||
|
/>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<Button onClick={handlePause} loading={loading} disabled={!told}>
|
||||||
|
Pause
|
||||||
|
</Button>
|
||||||
|
</>
|
||||||
}
|
}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user