summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2017-11-17 10:46:53 +0100
committerAndrej Mihajlov <and@mullvad.net>2017-11-21 16:12:59 +0100
commit489a47a2f68194daee05e24cced6ca670c3978a0 (patch)
tree5db85abba5e69dcf227b87bfa476bd8d22165770
parent3ca41569b1d61444d4a2bf0a0dc330fbc86435ca (diff)
downloadmullvadvpn-489a47a2f68194daee05e24cced6ca670c3978a0.tar.xz
mullvadvpn-489a47a2f68194daee05e24cced6ca670c3978a0.zip
Refine flow types across project
-rw-r--r--app/components/AccountInput.js2
-rw-r--r--app/lib/backend.js5
-rw-r--r--app/redux/account/actions.js11
3 files changed, 10 insertions, 8 deletions
diff --git a/app/components/AccountInput.js b/app/components/AccountInput.js
index 1759423437..4ff99e13fd 100644
--- a/app/components/AccountInput.js
+++ b/app/components/AccountInput.js
@@ -74,7 +74,7 @@ export default class AccountInput extends Component {
this.state.selectionRange[1] !== nextState.selectionRange[1]);
}
- render(): React.Element<*> {
+ render() {
const displayString = formatAccount(this.state.value || '');
const { value, onChange, onEnter, ...otherProps } = this.props; // eslint-disable-line no-unused-vars
return (
diff --git a/app/lib/backend.js b/app/lib/backend.js
index fe828ba6c8..fc2348961a 100644
--- a/app/lib/backend.js
+++ b/app/lib/backend.js
@@ -11,10 +11,9 @@ import { push } from 'react-router-redux';
import { defaultServer } from '../config';
import type { ReduxStore } from '../redux/store';
-import type { BackendState, RelayConstraintsUpdate } from './ipc-facade';
+import type { AccountToken, BackendState, RelayConstraintsUpdate } from './ipc-facade';
import type { ConnectionState } from '../redux/connection/reducers';
-export type EventType = 'connect' | 'connecting' | 'disconnect' | 'login' | 'logging' | 'logout' | 'updatedIp' | 'updatedLocation' | 'updatedReachability';
export type ErrorType = 'NO_CREDIT' | 'NO_INTERNET' | 'INVALID_ACCOUNT' | 'NO_ACCOUNT';
export type ServerInfo = {
@@ -168,7 +167,7 @@ export class Backend {
return (servers: ServerInfoList)[identifier];
}
- login(accountToken: string): Promise<void> {
+ login(accountToken: AccountToken): Promise<void> {
log.debug('Attempting to login with account number', accountToken);
this._store.dispatch(accountActions.startLogin(accountToken));
diff --git a/app/redux/account/actions.js b/app/redux/account/actions.js
index d528f4f3d0..a00fb85d16 100644
--- a/app/redux/account/actions.js
+++ b/app/redux/account/actions.js
@@ -1,15 +1,18 @@
// @flow
+import type { AccountToken } from '../../lib/ipc-facade';
import type { Backend, BackendError } from '../../lib/backend';
type StartLoginAction = {
type: 'START_LOGIN',
- accountToken?: string,
+ accountToken?: AccountToken,
};
+
type LoginSuccessfulAction = {
type: 'LOGIN_SUCCESSFUL',
expiry: string,
};
+
type LoginFailedAction = {
type: 'LOGIN_FAILED',
error: BackendError,
@@ -25,7 +28,7 @@ type ResetLoginErrorAction = {
type UpdateAccountTokenAction = {
type: 'UPDATE_ACCOUNT_TOKEN',
- token: string,
+ token: AccountToken,
};
export type AccountAction = StartLoginAction
@@ -34,7 +37,7 @@ export type AccountAction = StartLoginAction
| LoggedOutAction
| ResetLoginErrorAction;
-function startLogin(accountToken?: string): StartLoginAction {
+function startLogin(accountToken?: AccountToken): StartLoginAction {
return {
type: 'START_LOGIN',
accountToken: accountToken,
@@ -71,7 +74,7 @@ function resetLoginError(): ResetLoginErrorAction {
};
}
-function updateAccountToken(token: string): UpdateAccountTokenAction {
+function updateAccountToken(token: AccountToken): UpdateAccountTokenAction {
return {
type: 'UPDATE_ACCOUNT_TOKEN',
token: token,