mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-13 11:43:31 +00:00
26 lines
486 B
JavaScript
26 lines
486 B
JavaScript
/**
|
|
* @file
|
|
* @copyright 2020 Aleksej Komarov
|
|
* @license MIT
|
|
*/
|
|
|
|
import { createAction } from 'common/redux';
|
|
|
|
export const pingSuccess = createAction(
|
|
'ping/success',
|
|
ping => {
|
|
const now = Date.now();
|
|
const roundtrip = (now - ping.sentAt) * 0.5;
|
|
return {
|
|
payload: {
|
|
lastId: ping.id,
|
|
roundtrip,
|
|
},
|
|
meta: { now },
|
|
};
|
|
}
|
|
);
|
|
|
|
export const pingFail = createAction('ping/fail');
|
|
export const pingReply = createAction('ping/reply');
|