Skip to content

Commit 47099a3

Browse files
indifferentghostSaraVieira
authored andcommitted
🔨 Refactored app/pages/CLI/index.tsx (#2623)
1 parent 75a6f04 commit 47099a3

File tree

1 file changed

+24
-30
lines changed

1 file changed

+24
-30
lines changed
Lines changed: 24 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,37 @@
11
import React, { useEffect } from 'react';
2-
3-
import { inject, hooksObserver } from 'app/componentConnectors';
42
import { Navigation } from 'app/pages/common/Navigation';
5-
3+
import { useOvermind } from 'app/overmind';
64
import { Container } from './elements';
75
import { Prompt } from './Prompt';
86

9-
interface Props {
7+
interface CliProps {
108
small: boolean;
11-
store: any;
12-
signals: any;
139
}
1410

15-
const CLI = inject('store', 'signals')(
16-
hooksObserver(
17-
({
18-
signals: { cliMounted, signInCliClicked },
19-
store: { user, authToken, isLoadingCLI, error },
20-
}: Props) => {
21-
useEffect(() => {
22-
cliMounted();
23-
}, [cliMounted]);
11+
const CLI: React.FunctionComponent<CliProps> = ({ small }) => {
12+
const {
13+
state: { user, authToken, isLoadingCLI, error },
14+
actions: { cliMounted, signInCliClicked },
15+
} = useOvermind();
16+
17+
useEffect(() => {
18+
cliMounted();
19+
}, [cliMounted]);
2420

25-
return (
26-
<Container>
27-
<Navigation title="CLI Authorization" />
21+
return (
22+
<Container>
23+
<Navigation title="CLI Authorization" />
2824

29-
<Prompt
30-
error={error}
31-
loading={isLoadingCLI}
32-
signIn={signInCliClicked}
33-
token={authToken}
34-
username={user && user.username}
35-
/>
36-
</Container>
37-
);
38-
}
39-
)
40-
);
25+
<Prompt
26+
error={error}
27+
loading={isLoadingCLI}
28+
signIn={signInCliClicked}
29+
token={authToken}
30+
username={user && user.username}
31+
/>
32+
</Container>
33+
);
34+
};
4135

4236
// eslint-disable-next-line import/no-default-export
4337
export default CLI;

0 commit comments

Comments
 (0)