diff options
author | Ricardo Cino <ricardo@cino.io> | 2022-06-26 23:59:32 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-26 21:59:32 +0000 |
commit | 6bff2bb5439d25e0ab2a24a8ca1b28b89ef40ff9 (patch) | |
tree | 1676f5eef42b8086d28476c7eaad62c7b1753120 /src/containers/auth/ChangeServerScreen.tsx | |
parent | Reduce tab item layout shift (#376) (diff) | |
download | ferdium-app-6bff2bb5439d25e0ab2a24a8ca1b28b89ef40ff9.tar.gz ferdium-app-6bff2bb5439d25e0ab2a24a8ca1b28b89ef40ff9.tar.zst ferdium-app-6bff2bb5439d25e0ab2a24a8ca1b28b89ef40ff9.zip |
chore: turned all auth containers into typescript (#375)
Diffstat (limited to 'src/containers/auth/ChangeServerScreen.tsx')
-rw-r--r-- | src/containers/auth/ChangeServerScreen.tsx | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/containers/auth/ChangeServerScreen.tsx b/src/containers/auth/ChangeServerScreen.tsx new file mode 100644 index 000000000..6af87e4a1 --- /dev/null +++ b/src/containers/auth/ChangeServerScreen.tsx | |||
@@ -0,0 +1,33 @@ | |||
1 | import { Component, ReactElement } from 'react'; | ||
2 | import { inject, observer } from 'mobx-react'; | ||
3 | import { DefaultProps } from 'src/@types/ferdium-components.types'; | ||
4 | import ChangeServer from '../../components/auth/ChangeServer'; | ||
5 | |||
6 | class ChangeServerScreen extends Component<DefaultProps> { | ||
7 | constructor(props: DefaultProps) { | ||
8 | super(props); | ||
9 | |||
10 | this.onSubmit = this.onSubmit.bind(this); | ||
11 | } | ||
12 | |||
13 | onSubmit(values: any): void { | ||
14 | const { server } = values; | ||
15 | |||
16 | this.props.actions.settings.update({ | ||
17 | type: 'app', | ||
18 | data: { | ||
19 | server, | ||
20 | }, | ||
21 | }); | ||
22 | this.props.stores.router.push('/auth'); | ||
23 | } | ||
24 | |||
25 | render(): ReactElement { | ||
26 | const { stores } = this.props; | ||
27 | const { server } = stores.settings.all.app; | ||
28 | |||
29 | return <ChangeServer onSubmit={this.onSubmit} server={server} />; | ||
30 | } | ||
31 | } | ||
32 | |||
33 | export default inject('stores', 'actions')(observer(ChangeServerScreen)); | ||