mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 09:33:46 +00:00
chore(types): replace deprecated FormEvent with SyntheticEvent
React 19's @types/react flags FormEvent as deprecated — quote: 'FormEvent doesn't actually exist. You probably meant to use ChangeEvent, InputEvent, SubmitEvent, or just SyntheticEvent'. All 17 call sites in this repo typed form onSubmit handlers and only called e.preventDefault(), so SyntheticEvent is the correct general replacement. No behavior change — pure type-level cleanup that clears the chronic deprecation hint that has been showing up after every edit to any form-bearing page.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { useEffect, useState, type FormEvent } from 'react';
|
||||
import { useEffect, useState, type SyntheticEvent } from 'react';
|
||||
import { createPortal } from 'react-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useFocusTrap } from '../hooks/useFocusTrap';
|
||||
@@ -25,7 +25,7 @@ export function PromptDialogHost() {
|
||||
|
||||
if (!request) return null;
|
||||
|
||||
const handleSubmit = (e: FormEvent) => {
|
||||
const handleSubmit = (e: SyntheticEvent) => {
|
||||
e.preventDefault();
|
||||
const trimmed = value.trim();
|
||||
if (!trimmed) {
|
||||
|
||||
@@ -1704,7 +1704,7 @@ export default function AdminBulkActions() {
|
||||
return () => clearTimeout(searchTimerRef.current);
|
||||
}, []);
|
||||
|
||||
const handleSearchSubmit = (e: React.FormEvent) => {
|
||||
const handleSearchSubmit = (e: React.SyntheticEvent) => {
|
||||
e.preventDefault();
|
||||
clearTimeout(searchTimerRef.current);
|
||||
setOffset(0);
|
||||
|
||||
@@ -82,7 +82,7 @@ export default function AdminPartnerSettings() {
|
||||
formData.withdrawal_cooldown_days <= 365;
|
||||
const isValid = !formData.withdrawal_enabled || (isMinAmountValid && isCooldownValid);
|
||||
|
||||
const handleSubmit = (e: React.FormEvent) => {
|
||||
const handleSubmit = (e: React.SyntheticEvent) => {
|
||||
e.preventDefault();
|
||||
if (!isValid) return;
|
||||
updateMutation.mutate({
|
||||
|
||||
@@ -320,7 +320,7 @@ export default function AdminPolicyEdit() {
|
||||
}, []);
|
||||
|
||||
const handleSubmit = useCallback(
|
||||
(e: React.FormEvent) => {
|
||||
(e: React.SyntheticEvent) => {
|
||||
e.preventDefault();
|
||||
setFormError(null);
|
||||
|
||||
|
||||
@@ -351,7 +351,7 @@ export default function AdminRoleAssign() {
|
||||
}, []);
|
||||
|
||||
const handleAssign = useCallback(
|
||||
(e: React.FormEvent) => {
|
||||
(e: React.SyntheticEvent) => {
|
||||
e.preventDefault();
|
||||
setFormError(null);
|
||||
setFormSuccess(null);
|
||||
|
||||
@@ -334,7 +334,7 @@ export default function AdminRoleEdit() {
|
||||
}, []);
|
||||
|
||||
const handleSubmit = useCallback(
|
||||
(e: React.FormEvent) => {
|
||||
(e: React.SyntheticEvent) => {
|
||||
e.preventDefault();
|
||||
setFormError(null);
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ export default function AdminServerEdit() {
|
||||
},
|
||||
});
|
||||
|
||||
const handleSubmit = (e: React.FormEvent) => {
|
||||
const handleSubmit = (e: React.SyntheticEvent) => {
|
||||
e.preventDefault();
|
||||
const data: ServerUpdateRequest = {
|
||||
display_name: displayName,
|
||||
|
||||
@@ -87,7 +87,7 @@ export default function AdminTicketSettings() {
|
||||
const isValid =
|
||||
!formData.sla_enabled || (isSlaMinutesValid && isCheckIntervalValid && isReminderCooldownValid);
|
||||
|
||||
const handleSubmit = (e: React.FormEvent) => {
|
||||
const handleSubmit = (e: React.SyntheticEvent) => {
|
||||
e.preventDefault();
|
||||
if (!isValid) return;
|
||||
updateMutation.mutate({
|
||||
|
||||
@@ -177,7 +177,7 @@ export default function AdminTickets() {
|
||||
}
|
||||
};
|
||||
|
||||
const handleReply = async (e: React.FormEvent) => {
|
||||
const handleReply = async (e: React.SyntheticEvent) => {
|
||||
e.preventDefault();
|
||||
if (!selectedTicketId) return;
|
||||
if (attachments.some((a) => a.uploading || a.error)) return;
|
||||
|
||||
@@ -1221,7 +1221,7 @@ export default function AdminTrafficUsage() {
|
||||
}
|
||||
}, [toast]);
|
||||
|
||||
const handleSearch = (e: React.FormEvent) => {
|
||||
const handleSearch = (e: React.SyntheticEvent) => {
|
||||
e.preventDefault();
|
||||
setOffset(0);
|
||||
setCommittedSearch(searchInput);
|
||||
|
||||
@@ -210,7 +210,7 @@ export default function AdminUsers() {
|
||||
});
|
||||
const stats = statsQuery.data ?? null;
|
||||
|
||||
const handleSearch = (e: React.FormEvent) => {
|
||||
const handleSearch = (e: React.SyntheticEvent) => {
|
||||
e.preventDefault();
|
||||
};
|
||||
|
||||
|
||||
@@ -1076,7 +1076,7 @@ function InlinePrizeForm({
|
||||
promo_traffic_gb: prize?.promo_traffic_gb || 0,
|
||||
});
|
||||
|
||||
const handleSubmit = (e: React.FormEvent) => {
|
||||
const handleSubmit = (e: React.SyntheticEvent) => {
|
||||
e.preventDefault();
|
||||
onSave({
|
||||
...formData,
|
||||
|
||||
@@ -420,7 +420,7 @@ export default function ConnectedAccounts() {
|
||||
},
|
||||
});
|
||||
|
||||
const handleEmailSubmit = (e: React.FormEvent) => {
|
||||
const handleEmailSubmit = (e: React.SyntheticEvent) => {
|
||||
e.preventDefault();
|
||||
setEmailError(null);
|
||||
setEmailSuccess(null);
|
||||
|
||||
@@ -221,7 +221,7 @@ export default function Login() {
|
||||
}
|
||||
};
|
||||
|
||||
const handleEmailSubmit = async (e: React.FormEvent) => {
|
||||
const handleEmailSubmit = async (e: React.SyntheticEvent) => {
|
||||
e.preventDefault();
|
||||
setError('');
|
||||
|
||||
@@ -282,7 +282,7 @@ export default function Login() {
|
||||
}
|
||||
};
|
||||
|
||||
const handleForgotPassword = async (e: React.FormEvent) => {
|
||||
const handleForgotPassword = async (e: React.SyntheticEvent) => {
|
||||
e.preventDefault();
|
||||
setForgotPasswordError('');
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useState, useEffect, type FormEvent } from 'react';
|
||||
import { useState, useEffect, type SyntheticEvent } from 'react';
|
||||
import { useNavigate } from 'react-router';
|
||||
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
@@ -41,7 +41,7 @@ export default function ReferralPartnerApply() {
|
||||
},
|
||||
});
|
||||
|
||||
const handleSubmit = (e: FormEvent) => {
|
||||
const handleSubmit = (e: SyntheticEvent) => {
|
||||
e.preventDefault();
|
||||
const payload: PartnerApplicationRequest = {};
|
||||
if (form.company_name) payload.company_name = form.company_name;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useState, useEffect, type FormEvent } from 'react';
|
||||
import { useState, useEffect, type SyntheticEvent } from 'react';
|
||||
import { useNavigate } from 'react-router';
|
||||
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
@@ -37,7 +37,7 @@ export default function ReferralWithdrawalRequest() {
|
||||
},
|
||||
});
|
||||
|
||||
const handleSubmit = (e: FormEvent) => {
|
||||
const handleSubmit = (e: SyntheticEvent) => {
|
||||
e.preventDefault();
|
||||
if (form.payment_details.length < 5) return;
|
||||
if (form.amount_rubles <= 0) return;
|
||||
|
||||
@@ -15,7 +15,7 @@ export default function ResetPassword() {
|
||||
const [status, setStatus] = useState<'form' | 'loading' | 'success' | 'error'>('form');
|
||||
const [error, setError] = useState('');
|
||||
|
||||
const handleSubmit = async (e: React.FormEvent) => {
|
||||
const handleSubmit = async (e: React.SyntheticEvent) => {
|
||||
e.preventDefault();
|
||||
setError('');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user