From 85d1aac4cd70e79d5ab64684dea09e92b17ed2c2 Mon Sep 17 00:00:00 2001 From: muhamedsalih-tw <104364298+muhamedsalih-tw@users.noreply.github.com> Date: Tue, 1 Nov 2022 06:42:12 +0530 Subject: Transform ChangeServer components tree to typescript (#725) --- src/containers/auth/ChangeServerScreen.tsx | 24 +++++++++++++++--------- src/containers/auth/LoginScreen.tsx | 14 +++++++------- 2 files changed, 22 insertions(+), 16 deletions(-) (limited to 'src/containers') diff --git a/src/containers/auth/ChangeServerScreen.tsx b/src/containers/auth/ChangeServerScreen.tsx index 29320a001..db48479cc 100644 --- a/src/containers/auth/ChangeServerScreen.tsx +++ b/src/containers/auth/ChangeServerScreen.tsx @@ -2,8 +2,17 @@ import { Component, ReactElement } from 'react'; import { inject, observer } from 'mobx-react'; import { StoresProps } from '../../@types/ferdium-components.types'; import ChangeServer from '../../components/auth/ChangeServer'; +import { Actions } from '../../actions/lib/actions'; +import { RealStores } from '../../stores'; -class ChangeServerScreen extends Component { +interface IProps { + stores?: RealStores; + actions?: Actions; +} + +@inject('stores', 'actions') +@observer +class ChangeServerScreen extends Component { constructor(props: StoresProps) { super(props); @@ -13,21 +22,18 @@ class ChangeServerScreen extends Component { onSubmit(values: any): void { const { server } = values; - this.props.actions.settings.update({ + this.props.actions!.settings.update({ type: 'app', - data: { - server, - }, + data: { server }, }); - this.props.stores.router.push('/auth'); + this.props.stores!.router.push('/auth'); } render(): ReactElement { - const { stores } = this.props; - const { server } = stores.settings.all.app; + const { server } = this.props.stores!.settings.all.app; return ; } } -export default inject('stores', 'actions')(observer(ChangeServerScreen)); +export default ChangeServerScreen; diff --git a/src/containers/auth/LoginScreen.tsx b/src/containers/auth/LoginScreen.tsx index c4782d287..100736d19 100644 --- a/src/containers/auth/LoginScreen.tsx +++ b/src/containers/auth/LoginScreen.tsx @@ -6,7 +6,7 @@ import { } from '../../@types/ferdium-components.types'; import Login from '../../components/auth/Login'; -interface IProps extends Partial { +interface IProps extends StoresProps { error: GlobalError; } @@ -17,14 +17,14 @@ class LoginScreen extends Component { const { actions, stores, error } = this.props; return ( ); -- cgit v1.2.3-54-g00ecf