fix(admin): restore teacher profile form values

This commit is contained in:
2026-07-13 12:01:38 +08:00
parent 337d25e370
commit 8cadf8970e
3 changed files with 49 additions and 2 deletions

View File

@@ -15,6 +15,10 @@ import dayjs from 'dayjs';
import api from '../../api';
import PermissionButton from '../../components/PermissionButton';
import { message } from '../../ui/app-message';
import {
userProfileResponseToFormValues,
type UserProfileResponse,
} from './user-profile-form';
const UsersPage: React.FC = () => {
const [data, setData] = useState<any[]>([]);
@@ -36,8 +40,8 @@ const UsersPage: React.FC = () => {
const handleOpenProfile = async (record: any) => {
setProfileUser(record);
try {
const res: any = await api.get(`/rbac/users/${record.id}/profile`);
profileForm.setFieldsValue(res);
const res = await api.get<UserProfileResponse>(`/rbac/users/${record.id}/profile`);
profileForm.setFieldsValue(userProfileResponseToFormValues(res));
} catch {
profileForm.setFieldsValue({});
}