refactor(admin): remove email_verified field from user edit modal
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { useState, useEffect } from 'react';
|
import { useState, useEffect } from 'react';
|
||||||
import { Input, Select, TagInput, Modal } from '@zen/core/shared/components';
|
import { Input, TagInput, Modal } from '@zen/core/shared/components';
|
||||||
import { useToast } from '@zen/core/toast';
|
import { useToast } from '@zen/core/toast';
|
||||||
|
|
||||||
const UserEditModal = ({ userId, currentUserId, isOpen, onClose, onSaved }) => {
|
const UserEditModal = ({ userId, currentUserId, isOpen, onClose, onSaved }) => {
|
||||||
@@ -12,18 +12,13 @@ const UserEditModal = ({ userId, currentUserId, isOpen, onClose, onSaved }) => {
|
|||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [saving, setSaving] = useState(false);
|
const [saving, setSaving] = useState(false);
|
||||||
|
|
||||||
const [formData, setFormData] = useState({ name: '', email: '', email_verified: 'false', currentPassword: '' });
|
const [formData, setFormData] = useState({ name: '', email: '', currentPassword: '' });
|
||||||
const [errors, setErrors] = useState({});
|
const [errors, setErrors] = useState({});
|
||||||
|
|
||||||
const [allRoles, setAllRoles] = useState([]);
|
const [allRoles, setAllRoles] = useState([]);
|
||||||
const [selectedRoleIds, setSelectedRoleIds] = useState([]);
|
const [selectedRoleIds, setSelectedRoleIds] = useState([]);
|
||||||
const [initialRoleIds, setInitialRoleIds] = useState([]);
|
const [initialRoleIds, setInitialRoleIds] = useState([]);
|
||||||
|
|
||||||
const emailVerifiedOptions = [
|
|
||||||
{ value: 'false', label: 'Non vérifié' },
|
|
||||||
{ value: 'true', label: 'Vérifié' },
|
|
||||||
];
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!isOpen || !userId) return;
|
if (!isOpen || !userId) return;
|
||||||
loadAll();
|
loadAll();
|
||||||
@@ -49,7 +44,6 @@ const UserEditModal = ({ userId, currentUserId, isOpen, onClose, onSaved }) => {
|
|||||||
setFormData({
|
setFormData({
|
||||||
name: userJson.user.name || '',
|
name: userJson.user.name || '',
|
||||||
email: userJson.user.email || '',
|
email: userJson.user.email || '',
|
||||||
email_verified: userJson.user.email_verified ? 'true' : 'false',
|
|
||||||
currentPassword: '',
|
currentPassword: '',
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -97,7 +91,6 @@ const UserEditModal = ({ userId, currentUserId, isOpen, onClose, onSaved }) => {
|
|||||||
credentials: 'include',
|
credentials: 'include',
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
name: formData.name.trim(),
|
name: formData.name.trim(),
|
||||||
email_verified: formData.email_verified === 'true',
|
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
const userResData = await userRes.json();
|
const userResData = await userRes.json();
|
||||||
@@ -226,13 +219,6 @@ const UserEditModal = ({ userId, currentUserId, isOpen, onClose, onSaved }) => {
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<Select
|
|
||||||
label="Email vérifié"
|
|
||||||
value={formData.email_verified}
|
|
||||||
onChange={(value) => handleInputChange('email_verified', value)}
|
|
||||||
options={emailVerifiedOptions}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<TagInput
|
<TagInput
|
||||||
label="Rôles attribués"
|
label="Rôles attribués"
|
||||||
options={roleOptions}
|
options={roleOptions}
|
||||||
|
|||||||
Reference in New Issue
Block a user