Files
CHOMPStation2/tgui/packages/tgui-panel/settings/hooks.js
CHOMPStation2 eb65b5721c [MIRROR] tgchat part 1 (#7273)
Co-authored-by: Heroman3003 <31296024+Heroman3003@users.noreply.github.com>
Co-authored-by: Selis <selis@xynolabs.com>
2023-11-25 13:36:55 +01:00

21 lines
543 B
JavaScript

/**
* @file
* @copyright 2020 Aleksej Komarov
* @license MIT
*/
import { useDispatch, useSelector } from 'common/redux';
import { updateSettings, toggleSettings } from './actions';
import { selectSettings } from './selectors';
export const useSettings = (context) => {
const settings = useSelector(context, selectSettings);
const dispatch = useDispatch(context);
return {
...settings,
visible: settings.view.visible,
toggle: () => dispatch(toggleSettings()),
update: (obj) => dispatch(updateSettings(obj)),
};
};