2017-10-13 19:31:05 +00:00
|
|
|
// @flow
|
2017-04-21 10:00:50 +00:00
|
|
|
|
2017-11-23 16:26:47 +00:00
|
|
|
import { SET_CALLEE_INFO_VISIBLE, SET_JWT } from './actionTypes';
|
2017-06-05 18:19:25 +00:00
|
|
|
|
|
|
|
/**
|
2017-11-23 16:26:47 +00:00
|
|
|
* Sets the visibility of {@code CalleeInfo}.
|
2017-06-05 18:19:25 +00:00
|
|
|
*
|
2017-11-23 16:26:47 +00:00
|
|
|
* @param {boolean|undefined} [calleeInfoVisible] - If {@code CalleeInfo} is
|
2017-10-13 19:31:05 +00:00
|
|
|
* to be displayed/visible, then {@code true}; otherwise, {@code false} or
|
2017-06-05 18:19:25 +00:00
|
|
|
* {@code undefined}.
|
|
|
|
* @returns {{
|
2017-11-23 16:26:47 +00:00
|
|
|
* type: SET_CALLEE_INFO_VISIBLE,
|
|
|
|
* calleeInfoVisible: (boolean|undefined)
|
2017-06-05 18:19:25 +00:00
|
|
|
* }}
|
|
|
|
*/
|
2017-11-23 16:26:47 +00:00
|
|
|
export function setCalleeInfoVisible(calleeInfoVisible: ?boolean) {
|
2017-06-05 18:19:25 +00:00
|
|
|
return (dispatch: Dispatch<*>, getState: Function) => {
|
2017-10-05 22:54:13 +00:00
|
|
|
getState()['features/base/jwt']
|
2017-11-23 16:26:47 +00:00
|
|
|
.calleeInfoVisible === calleeInfoVisible
|
2017-06-05 18:19:25 +00:00
|
|
|
|| dispatch({
|
2017-11-23 16:26:47 +00:00
|
|
|
type: SET_CALLEE_INFO_VISIBLE,
|
|
|
|
calleeInfoVisible
|
2017-06-05 18:19:25 +00:00
|
|
|
});
|
|
|
|
};
|
|
|
|
}
|
2017-04-21 10:00:50 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Stores a specific JSON Web Token (JWT) into the redux store.
|
|
|
|
*
|
2017-10-13 19:31:05 +00:00
|
|
|
* @param {string} [jwt] - The JSON Web Token (JWT) to store.
|
2017-04-21 10:00:50 +00:00
|
|
|
* @returns {{
|
|
|
|
* type: SET_TOKEN_DATA,
|
2017-10-13 19:31:05 +00:00
|
|
|
* jwt: (string|undefined)
|
2017-04-21 10:00:50 +00:00
|
|
|
* }}
|
|
|
|
*/
|
2017-10-13 19:31:05 +00:00
|
|
|
export function setJWT(jwt: ?string) {
|
2017-04-21 10:00:50 +00:00
|
|
|
return {
|
|
|
|
type: SET_JWT,
|
|
|
|
jwt
|
|
|
|
};
|
|
|
|
}
|