summaryrefslogtreecommitdiffhomepage
path: root/app/redux
diff options
context:
space:
mode:
authorJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2018-07-24 13:11:41 -0300
committerJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2018-07-24 13:12:43 -0300
commit18b37cc66631bfbf17eded4d609c1ae12d5f6ccc (patch)
tree878db7d308dc322abc5546ead569cd4c7e34023c /app/redux
parentd1632102fbf53032b87fc8f6bcdc7299ee411b15 (diff)
downloadmullvadvpn-18b37cc66631bfbf17eded4d609c1ae12d5f6ccc.tar.xz
mullvadvpn-18b37cc66631bfbf17eded4d609c1ae12d5f6ccc.zip
Copy account token to clipboard when clicked
Diffstat (limited to 'app/redux')
-rw-r--r--app/redux/account/actions.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/redux/account/actions.js b/app/redux/account/actions.js
index 41fbfdee05..3cc4b83681 100644
--- a/app/redux/account/actions.js
+++ b/app/redux/account/actions.js
@@ -1,6 +1,17 @@
// @flow
+import { Clipboard } from 'reactxp';
import type { AccountToken } from '../../lib/daemon-rpc';
+import type { ReduxThunk } from '../store';
+
+const copyAccountToken = (): ReduxThunk => {
+ return (_, getState) => {
+ const accountToken = getState().account.accountToken;
+ if (accountToken) {
+ Clipboard.setText(accountToken);
+ }
+ };
+};
type StartLoginAction = {
type: 'START_LOGIN',
@@ -109,6 +120,7 @@ function updateAccountExpiry(expiry: string): UpdateAccountExpiryAction {
}
export default {
+ copyAccountToken,
startLogin,
loginSuccessful,
loginFailed,