Skip to content

Commit

Permalink
when a user does not have an alias, go to the edit page by id
Browse files Browse the repository at this point in the history
  • Loading branch information
Laoujin committed Jan 14, 2025
1 parent 2b3d57b commit dc5ec2e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions frontend/src/components/users/EditUser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ export const EditUser = () => {
const navigate = useNavigate();
const dispatch = useDispatch();
const params = useParams();
const model = useSelector((state: ConfacState) => state.user.users.find(c => c.alias === params.id));
const model = useSelector((state: ConfacState) => state.user.users.find(c => c.alias === params.id || c._id === params.id));
const [user, setUser] = useState<UserModel>(model || getNewUser());

useEntityChangedToast(user._id);

const docTitle = user._id ? 'userEdit' : 'userNew';
useDocumentTitle(docTitle, {name: `${user.firstName} ${user.name}`});


if (model && !user._id) {
setUser(model);
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/users/models/getUserFeature.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const userListConfig = (config: UserFeatureBuilderConfig): IList<UserModel, User
header: {title: '', width: 110},
value: m => (
<>
<EditIcon onClick={`/users/${m.alias}`} style={{marginRight: 15}} size={1} />
<EditIcon onClick={`/users/${m.alias || m._id}`} style={{marginRight: 15}} size={1} />
<DeleteIcon
claim={Claim.ManageUsers}
onClick={() => config.save({...m, active: !m.active})}
Expand Down

0 comments on commit dc5ec2e

Please sign in to comment.