diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/account_settings/account_settings.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/account_settings/account_settings.tsx index 3a23f8dadf70ff..e28faaeec8993a 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/account_settings/account_settings.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/account_settings/account_settings.tsx @@ -10,12 +10,10 @@ import React, { useState, useEffect, useMemo } from 'react'; import { useValues } from 'kea'; import type { AuthenticatedUser } from '../../../../../../security/public'; -import { HttpLogic } from '../../../shared/http/http_logic'; import { KibanaLogic } from '../../../shared/kibana/kibana_logic'; export const AccountSettings: React.FC = () => { - const { security, notifications } = useValues(KibanaLogic); - const { http } = useValues(HttpLogic); + const { security } = useValues(KibanaLogic); const [currentUser, setCurrentUser] = useState(null); @@ -23,7 +21,6 @@ export const AccountSettings: React.FC = () => { security!.authc!.getCurrentUser().then(setCurrentUser); }, [security.authc]); - const UserAPIClient = security!.uiApi!.UserAPIClient; const PersonalInfo = useMemo(() => security!.uiApi!.components.getPersonalInfo, [security.uiApi]); const ChangePassword = useMemo(() => security!.uiApi!.components.getChangePassword, [ security.uiApi, @@ -36,11 +33,7 @@ export const AccountSettings: React.FC = () => { return ( <> - + ); }; diff --git a/x-pack/plugins/security/public/account_management/change_password/change_password_async.tsx b/x-pack/plugins/security/public/account_management/change_password/change_password_async.tsx index 628cfe701705aa..4dabd2f7b79429 100644 --- a/x-pack/plugins/security/public/account_management/change_password/change_password_async.tsx +++ b/x-pack/plugins/security/public/account_management/change_password/change_password_async.tsx @@ -7,11 +7,23 @@ import React from 'react'; +import type { CoreStart } from 'src/core/public'; + +import { UserAPIClient } from '../../management/users'; import type { ChangePasswordProps } from './change_password'; -export const getChangePasswordComponent = async (): Promise> => { +export const getChangePasswordComponent = async ( + core: CoreStart +): Promise>> => { const { ChangePassword } = await import('./change_password'); - return (props: ChangePasswordProps) => { - return ; + + return (props: Pick) => { + return ( + + ); }; }; diff --git a/x-pack/plugins/security/public/ui_api/components.tsx b/x-pack/plugins/security/public/ui_api/components.tsx index a595a361a04ddd..eeee7946663b77 100644 --- a/x-pack/plugins/security/public/ui_api/components.tsx +++ b/x-pack/plugins/security/public/ui_api/components.tsx @@ -30,6 +30,6 @@ export const getComponents = ({ core }: GetComponentsOptions) => { return { getPersonalInfo: wrapLazy(getPersonalInfoComponent), - getChangePassword: wrapLazy(getChangePasswordComponent), + getChangePassword: wrapLazy(() => getChangePasswordComponent(core)), }; }; diff --git a/x-pack/plugins/security/public/ui_api/index.ts b/x-pack/plugins/security/public/ui_api/index.ts index 1de70e584a512d..98c020e91e2034 100644 --- a/x-pack/plugins/security/public/ui_api/index.ts +++ b/x-pack/plugins/security/public/ui_api/index.ts @@ -23,7 +23,7 @@ type LazyComponentFn = (props: T) => ReactElement; export interface UiApi { components: { getPersonalInfo: LazyComponentFn; - getChangePassword: LazyComponentFn; + getChangePassword: LazyComponentFn>; }; UserAPIClient: typeof UserAPIClient; }