fix
This commit is contained in:
@@ -64,6 +64,8 @@ export default function SectionDetailPage() {
|
||||
uiConfig: undefined,
|
||||
});
|
||||
|
||||
const [editSlug, setEditSlug] = useState('');
|
||||
|
||||
// Options editor state
|
||||
const [optionInput, setOptionInput] = useState({ value: '', label: '' });
|
||||
|
||||
@@ -128,6 +130,7 @@ export default function SectionDetailPage() {
|
||||
|
||||
const openEditFieldModal = (field: ProfileField) => {
|
||||
setSelectedField(field);
|
||||
setEditSlug(field.slug);
|
||||
setFieldForm({
|
||||
sectionId,
|
||||
name: field.name,
|
||||
@@ -183,7 +186,11 @@ export default function SectionDetailPage() {
|
||||
setModalError('');
|
||||
try {
|
||||
const { sectionId: _, ...updateData } = fieldForm;
|
||||
await profileFieldsService.update(selectedField.id, updateData as UpdateFieldDto);
|
||||
const updatePayload: UpdateFieldDto = { ...updateData };
|
||||
if (editSlug && editSlug !== selectedField.slug) {
|
||||
updatePayload.slug = editSlug;
|
||||
}
|
||||
await profileFieldsService.update(selectedField.id, updatePayload);
|
||||
closeFieldModal();
|
||||
fetchData();
|
||||
} catch (err) {
|
||||
@@ -669,6 +676,19 @@ export default function SectionDetailPage() {
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
{fieldModalType === 'edit' && (
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-[#00293d] mb-1">
|
||||
Slug
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
value={editSlug}
|
||||
onChange={(e) => setEditSlug(e.target.value.toLowerCase().replace(/[^a-z0-9_]/g, '_'))}
|
||||
className="w-full px-3 py-2 border border-[#e5e7eb] rounded-xl focus:outline-none focus:border-[#f5a623] text-[#00293d] bg-white font-mono text-sm"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-[#00293d] mb-1">
|
||||
Field Type <span className="text-red-500">*</span>
|
||||
|
||||
@@ -100,6 +100,7 @@ export interface CreateFieldDto {
|
||||
|
||||
export interface UpdateFieldDto {
|
||||
name?: string;
|
||||
slug?: string;
|
||||
fieldType?: FieldType;
|
||||
description?: string;
|
||||
placeholder?: string;
|
||||
|
||||
Reference in New Issue
Block a user