};
export const openUserManagement = (uuid: string) =>
- (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+ async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
const { resources } = getState();
const data = getResource<UserResource>(uuid)(resources);
dispatch(dialogActions.OPEN_DIALOG({ id: USER_MANAGEMENT_DIALOG, data }));
export const loginAs = (uuid: string) =>
async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
- const client = await services.apiClientAuthorizationService.get(uuid);
- dispatch<any>(saveApiToken(client.apiToken));
+ const client = await services.apiClientAuthorizationService.create({ ownerUuid: uuid });
+ dispatch<any>(saveApiToken(`v2/${client.uuid}/${client.apiToken}`));
+ await location.reload();
dispatch<any>(getUserDetails()).then(() => {
- location.reload();
dispatch<any>(navigateToRootProject);
});
};