File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import I18n from "../locale/I18n";
33import "../components/Entities.scss" ;
44import { Chip , ChipType , Tooltip } from "@surfnet/sds" ;
55import { Entities } from "../components/Entities" ;
6- import { searchUsers } from "../api" ;
6+ import { other , searchUsers } from "../api" ;
77import UserIcon from "@surfnet/sds/icons/functional-icons/id-2.svg" ;
88import "./Users.scss" ;
99import { isEmpty , stopEvent } from "../utils/Utils" ;
@@ -120,9 +120,12 @@ export const Users = () => {
120120 const showImpersonation = currentUser && currentUser . superUser ;
121121
122122 const impersonate = user => {
123- startImpersonation ( user ) ;
124- setFlash ( I18n . t ( "impersonate.flash.startedImpersonation" , { name : user . name } ) ) ;
125- navigate ( "/" , { replace : true } ) ;
123+ //First, fetch the entire other user otherwise we get undefined errors
124+ other ( user . id ) . then ( otherUser => {
125+ startImpersonation ( otherUser ) ;
126+ setFlash ( I18n . t ( "impersonate.flash.startedImpersonation" , { name : otherUser . name } ) ) ;
127+ navigate ( "/" , { replace : true } ) ;
128+ } )
126129 }
127130
128131 if ( showImpersonation ) {
You can’t perform that action at this time.
0 commit comments