bigbuffet-rw/app/soapbox/actions/remote_timeline.js
marcin mikołajczak 1e74c6d3d7 TypeScript, FC, styles and fixes
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2022-05-28 18:03:19 +02:00

24 lines
732 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.push(host)));
};
}
export function unpinHost(host) {
return (dispatch, getState) => {
const state = getState();
const pinnedHosts = getPinnedHosts(state);
return dispatch(changeSetting(['remote_timeline', 'pinnedHosts'], pinnedHosts.filter((value) => value !== host)));
};
}