diff --git a/webclient/src/Account.js b/webclient/src/Account.js index aaba18a..ce0a62b 100644 --- a/webclient/src/Account.js +++ b/webclient/src/Account.js @@ -14,6 +14,7 @@ function LogoutEverywhere(props) { const handleClick = () => { if (yousure) { + if (loading) return; setLoading(true); requester('/rest-auth/logout/', 'POST', token, {}) .then(res => { @@ -58,6 +59,7 @@ function ChangePasswordForm(props) { const handleChange = (e) => handleValues(e, e.currentTarget); const handleSubmit = (e) => { + if (loading) return; setLoading(true); requester('/password/change/', 'POST', token, input) .then(res => { @@ -122,6 +124,7 @@ export function AccountForm(props) { const handleCheck = (e, v) => setInput({ ...input, [v.name]: v.checked }); const handleSubmit = (e) => { + if (loading) return; setLoading(true); requester('/members/' + member.id + '/', 'PATCH', token, input) .then(res => { diff --git a/webclient/src/Admin.js b/webclient/src/Admin.js index ec2e391..6056408 100644 --- a/webclient/src/Admin.js +++ b/webclient/src/Admin.js @@ -54,6 +54,7 @@ export function AdminTransactions(props) { const { id } = useParams(); const handleSubmit = (e) => { + if (loading) return; setLoading(true); setSuccess(false); const data = { ...input, member_id: id }; @@ -118,6 +119,7 @@ function AdminCardDetail(props) { const handleCheck = (e, v) => setInput({ ...input, [v.name]: v.checked }); const handleSubmit = (e) => { + if (loading) return; setLoading(true); setSuccess(false); const data = { ...input, member_id: result.member.id }; @@ -226,6 +228,7 @@ export function AdminMemberCards(props) { const handleCheck = (e, v) => setInput({ ...input, [v.name]: v.checked }); const handleSubmit = (e) => { + if (loading) return; setLoading(true); setSuccess(false); const data = { ...input, member_id: result.member.id }; @@ -328,6 +331,7 @@ export function AdminMemberPause(props) { const handlePause = (e) => { if (yousure) { + if (loading) return; setLoading(true); setSuccess(false); requester('/members/' + id + '/pause/', 'POST', token, {}) @@ -348,6 +352,7 @@ export function AdminMemberPause(props) { }; const handleUnpause = (e) => { + if (loading) return; setLoading(true); setSuccess(false); requester('/members/' + id + '/unpause/', 'POST', token, {}) @@ -405,6 +410,7 @@ export function AdminMemberForm(props) { const handleCheck = (e, v) => setInput({ ...input, [v.name]: v.checked }); const handleSubmit = (e) => { + if (loading) return; setLoading(true); setSuccess(false); requester('/members/' + id + '/', 'PATCH', token, input) diff --git a/webclient/src/InstructorClasses.js b/webclient/src/InstructorClasses.js index 8de9b6d..bb11ddd 100644 --- a/webclient/src/InstructorClasses.js +++ b/webclient/src/InstructorClasses.js @@ -151,6 +151,7 @@ export function InstructorClassDetail(props) { const { id } = useParams(); const handleSubmit = (e) => { + if (loading) return; setLoading(true); setSuccess(false); requester('/sessions/'+id+'/', 'PUT', token, input) @@ -202,6 +203,7 @@ export function InstructorClassList(props) { const [success, setSuccess] = useState(false); const handleSubmit = (e) => { + if (loading) return; setLoading(true); setSuccess(false); const data = { ...input, course: course.id }; diff --git a/webclient/src/InstructorCourses.js b/webclient/src/InstructorCourses.js index 3088a70..24d0fe1 100644 --- a/webclient/src/InstructorCourses.js +++ b/webclient/src/InstructorCourses.js @@ -79,6 +79,7 @@ export function InstructorCourseDetail(props) { const { id } = useParams(); const handleSubmit = (e) => { + if (loading) return; setLoading(true); setSuccess(false); const data = { ...input, is_old: false }; @@ -131,6 +132,7 @@ export function InstructorCourseList(props) { const [success, setSuccess] = useState(false); const handleSubmit = (e) => { + if (loading) return; setLoading(true); setSuccess(false); const data = { ...input, is_old: false }; diff --git a/webclient/src/LoginSignup.js b/webclient/src/LoginSignup.js index c38cb18..9b99178 100644 --- a/webclient/src/LoginSignup.js +++ b/webclient/src/LoginSignup.js @@ -13,6 +13,7 @@ export function LoginForm(props) { const handleChange = (e) => handleValues(e, e.currentTarget); const handleSubmit = (e) => { + if (loading) return; setLoading(true); const data = { ...input, username: input.username.toLowerCase() }; requester('/rest-auth/login/', 'POST', '', data) @@ -68,6 +69,7 @@ export function SignupForm(props) { ); const handleSubmit = (e) => { + if (loading) return; setLoading(true); input.username = genUsername(); requester('/registration/', 'POST', '', input) diff --git a/webclient/src/Transactions.js b/webclient/src/Transactions.js index 63bda25..982ae8c 100644 --- a/webclient/src/Transactions.js +++ b/webclient/src/Transactions.js @@ -148,6 +148,7 @@ function EditTransaction(props) { const { id } = useParams(); const handleSubmit = (e) => { + if (loading) return; setLoading(true); setSuccess(false); const data = { ...input, report_type: null, report_memo: '' }; @@ -199,6 +200,7 @@ function ReportTransaction(props) { const handleCheck = (e, v) => setInput({ ...input, [v.name]: v.checked }); const handleSubmit = (e) => { + if (loading) return; setLoading(true); setSuccess(false); requester('/transactions/'+id+'/report/', 'POST', token, input)