bigbuffet-rw/app/soapbox/actions/remote_timeline.js
2021-08-11 19:38:25 -05:00

24 lines
710 B
JavaScript

import { getSettings, changeSetting } from 'soapbox/actions/settings';
const getPinnedHosts = state => {
const settings = getSettings(state);
return settings.getIn(['remote_timeline', 'pinnedHosts']);
};
export function pinHost(host) {
return (dispatch, getState) => {
const state = getState();
const pinnedHosts = getPinnedHosts(state);
return dispatch(changeSetting(['remote_timeline', 'pinnedHosts'], pinnedHosts.add(host)));
};
}
export function unpinHost(host) {
return (dispatch, getState) => {
const state = getState();
const pinnedHosts = getPinnedHosts(state);
return dispatch(changeSetting(['remote_timeline', 'pinnedHosts'], pinnedHosts.delete(host)));
};
}