fixed code v2

This commit is contained in:
SlimusMinus
2026-08-12 00:38:04 +03:00
parent fe3c91446a
commit e45c9326ed
19 changed files with 233 additions and 124 deletions

View File

@@ -124,13 +124,12 @@ function ContactFields({ form, errors, onChange, onPhoneChange }) {
}
// ─── Submit button ──────────────────────────────────────────────────────────
function SubmitButton({ loading, onSubmit }) {
function SubmitButton({ loading }) {
const { t } = useTranslation();
return (
<button
className="f-m-submit"
type="submit"
onClick={onSubmit}
disabled={loading}
>
<div className="f-m-submit-row">

View File

@@ -69,12 +69,12 @@ export default function ProfileModal({ onClose, initialData = {} }) {
avatar: newAvatars.length > 0 ? newAvatars[0] : (keptExisting.length > 0 ? keptExisting[0] : null),
};
const updatedUser = await updateProfile(user?.id, profileData);
if (updatedUser) {
updateUser(updatedUser);
const result = await updateProfile(user?.id, profileData);
if (result.success) {
updateUser(result.data);
onClose();
}
// при неудаче result.error уже отражена в saveError через error state хука
};
return (
@@ -116,9 +116,9 @@ export default function ProfileModal({ onClose, initialData = {} }) {
onPhoneChange={handlePhoneChange}
/>
{saveError && <p className="f-err-msg" style={{ marginBottom: 10 }}>{saveError}</p>}
{saveError && <p className="f-err-msg auth-form-error">{saveError}</p>}
<SubmitButton loading={compressing || saving} onSubmit={handleSubmit} />
<SubmitButton loading={compressing || saving} />
<button
type="button"