summaryrefslogtreecommitdiffstats
path: root/src/containers/auth/ChangeServerScreen.tsx
diff options
context:
space:
mode:
authorLibravatar muhamedsalih-tw <104364298+muhamedsalih-tw@users.noreply.github.com>2022-11-01 06:42:12 +0530
committerLibravatar GitHub <noreply@github.com>2022-11-01 01:12:12 +0000
commit85d1aac4cd70e79d5ab64684dea09e92b17ed2c2 (patch)
treea006a2eb5c58b9351219d8a85d57a04c5c73787a /src/containers/auth/ChangeServerScreen.tsx
parentrefactor: convert global app to typescript (#723) (diff)
downloadferdium-app-85d1aac4cd70e79d5ab64684dea09e92b17ed2c2.tar.gz
ferdium-app-85d1aac4cd70e79d5ab64684dea09e92b17ed2c2.tar.zst
ferdium-app-85d1aac4cd70e79d5ab64684dea09e92b17ed2c2.zip
Transform ChangeServer components tree to typescript (#725)
Diffstat (limited to 'src/containers/auth/ChangeServerScreen.tsx')
-rw-r--r--src/containers/auth/ChangeServerScreen.tsx24
1 files changed, 15 insertions, 9 deletions
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';
2import { inject, observer } from 'mobx-react'; 2import { inject, observer } from 'mobx-react';
3import { StoresProps } from '../../@types/ferdium-components.types'; 3import { StoresProps } from '../../@types/ferdium-components.types';
4import ChangeServer from '../../components/auth/ChangeServer'; 4import ChangeServer from '../../components/auth/ChangeServer';
5import { Actions } from '../../actions/lib/actions';
6import { RealStores } from '../../stores';
5 7
6class ChangeServerScreen extends Component<StoresProps> { 8interface IProps {
9 stores?: RealStores;
10 actions?: Actions;
11}
12
13@inject('stores', 'actions')
14@observer
15class ChangeServerScreen extends Component<IProps> {
7 constructor(props: StoresProps) { 16 constructor(props: StoresProps) {
8 super(props); 17 super(props);
9 18
@@ -13,21 +22,18 @@ class ChangeServerScreen extends Component<StoresProps> {
13 onSubmit(values: any): void { 22 onSubmit(values: any): void {
14 const { server } = values; 23 const { server } = values;
15 24
16 this.props.actions.settings.update({ 25 this.props.actions!.settings.update({
17 type: 'app', 26 type: 'app',
18 data: { 27 data: { server },
19 server,
20 },
21 }); 28 });
22 this.props.stores.router.push('/auth'); 29 this.props.stores!.router.push('/auth');
23 } 30 }
24 31
25 render(): ReactElement { 32 render(): ReactElement {
26 const { stores } = this.props; 33 const { server } = this.props.stores!.settings.all.app;
27 const { server } = stores.settings.all.app;
28 34
29 return <ChangeServer onSubmit={this.onSubmit} server={server} />; 35 return <ChangeServer onSubmit={this.onSubmit} server={server} />;
30 } 36 }
31} 37}
32 38
33export default inject('stores', 'actions')(observer(ChangeServerScreen)); 39export default ChangeServerScreen;