mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
Co-authored-by: Heroman3003 <31296024+Heroman3003@users.noreply.github.com> Co-authored-by: Selis <selis@xynolabs.com>
21 lines
543 B
JavaScript
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)),
|
|
};
|
|
};
|