blob: a63496661ae726c07d019f89a30d0a37010200bb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
import { clipboard } from 'electron';
import { createAction } from 'redux-actions';
/** Action for changing connection state */
const connectionChange = createAction('CONNECTION_CHANGE');
/** Action for connecting to server */
const connect = (backend, addr) => () => backend.connect(addr);
/** Action for disconnecting from server */
const disconnect = (backend) => () => backend.disconnect();
/** Action for copying IP address in memory */
const copyIPAddress = () => {
return (_, getState) => {
const ip = getState().connect.clientIp;
if(typeof(ip) === 'string') {
clipboard.writeText(ip);
}
};
};
export default { connect, disconnect, copyIPAddress, connectionChange };
|