Disable buttons while loading

This commit is contained in:
Tanner Collin 2020-09-15 19:42:09 +00:00
parent 3b8e0097a1
commit 440d389f16
3 changed files with 5 additions and 0 deletions

View File

@ -541,6 +541,7 @@ export function AdminCert(props) {
const handleCert = (e) => {
e.preventDefault();
if (loading) return;
setLoading(true);
let data = Object();
data[field] = moment.utc().tz('America/Edmonton').format('YYYY-MM-DD');
@ -555,6 +556,7 @@ export function AdminCert(props) {
const handleUncert = (e) => {
e.preventDefault();
if (loading) return;
setLoading(true);
let data = Object();
data[field] = null;

View File

@ -109,6 +109,7 @@ export function ClassDetail(props) {
}, [refreshCount]);
const handleSignup = () => {
if (loading) return;
setLoading(true);
const data = { attendance_status: 'Waiting for payment', session: id };
requester('/training/', 'POST', token, data)
@ -122,6 +123,7 @@ export function ClassDetail(props) {
};
const handleToggle = (newStatus) => {
if (loading) return;
setLoading(true);
const data = { attendance_status: newStatus, session: id };
requester('/training/'+userTraining.id+'/', 'PUT', token, data)

View File

@ -71,6 +71,7 @@ function AttendanceRow(props) {
const [loading, setLoading] = useState(false);
const handleMark = (newStatus) => {
if (loading) return;
setLoading(newStatus);
const data = { ...student, attendance_status: newStatus };
requester('/training/'+student.id+'/', 'PATCH', token, data)