diff options
| author | Erik Larkö <erik@mullvad.net> | 2017-07-24 15:48:25 +0200 |
|---|---|---|
| committer | Erik Larkö <erik@mullvad.net> | 2017-07-27 07:57:14 +0200 |
| commit | 69fa46aa512fbf1478fe997b987439d0494de6cb (patch) | |
| tree | 4f228a255e4cd91a3a15a2a4686e8d3f9718ecc0 | |
| parent | 4e017c49c3bc6985b58f328181bfd3a2e7b20e08 (diff) | |
| download | mullvadvpn-69fa46aa512fbf1478fe997b987439d0494de6cb.tar.xz mullvadvpn-69fa46aa512fbf1478fe997b987439d0494de6cb.zip | |
Flow connection actions
| -rw-r--r-- | app/redux/connection/actions.js | 8 | ||||
| -rw-r--r-- | app/redux/store.js | 2 |
2 files changed, 6 insertions, 4 deletions
diff --git a/app/redux/connection/actions.js b/app/redux/connection/actions.js index d91c77f848..4639feaf65 100644 --- a/app/redux/connection/actions.js +++ b/app/redux/connection/actions.js @@ -1,7 +1,9 @@ +// @flow + import { clipboard } from 'electron'; import { createAction } from 'redux-actions'; -import type { Backend } from '../lib/backend'; +import type { Backend } from '../../lib/backend'; import type { ConnectionReduxState } from './reducers.js'; import type { ReduxAction, ReduxGetStateFn, ReduxDispatchFn } from '../store'; @@ -11,8 +13,8 @@ const connectionChange: ConnectionChangeAction = createAction('CONNECTION_CHANGE const connect = (backend: Backend, addr: string) => () => backend.connect(addr); const disconnect = (backend: Backend) => () => backend.disconnect(); const copyIPAddress = () => { - return (_dispatch: ReduxDispatchFn, getState: ReduxGetStateFn) => { - const ip: ?string = getState().connect.clientIp; + return (_dispatch: ReduxDispatchFn<*>, getState: ReduxGetStateFn) => { + const ip: ?string = getState().connection.clientIp; if(ip) { clipboard.writeText(ip); } diff --git a/app/redux/store.js b/app/redux/store.js index 5d12d9af6c..80060c59a9 100644 --- a/app/redux/store.js +++ b/app/redux/store.js @@ -21,7 +21,7 @@ export type ReduxState = { connection: ConnectionReduxState, settings: SettingsReduxState }; -export type ReduxAction<T> = { type: string, payload: T }; +export type ReduxAction<T> = { type: string, payload: T } | Function; export type ReduxStore = Store<ReduxState, ReduxAction<Object>>; export type ReduxGetStateFn = () => ReduxState; export type ReduxDispatchFn<T: *> = Dispatch<ReduxAction<T>>; |
