2020-09-14 20:07:33 -07:00
|
|
|
import api from '../api';
|
2020-09-19 16:32:43 -07:00
|
|
|
import { showAlert } from 'soapbox/actions/alerts';
|
2020-09-14 20:07:33 -07:00
|
|
|
|
|
|
|
export const IMPORT_FOLLOWS_REQUEST = 'IMPORT_FOLLOWS_REQUEST';
|
|
|
|
export const IMPORT_FOLLOWS_SUCCESS = 'IMPORT_FOLLOWS_SUCCESS';
|
|
|
|
export const IMPORT_FOLLOWS_FAIL = 'IMPORT_FOLLOWS_FAIL';
|
|
|
|
|
2020-09-19 16:32:43 -07:00
|
|
|
export function importFollows(params) {
|
2020-09-14 20:07:33 -07:00
|
|
|
return (dispatch, getState) => {
|
|
|
|
dispatch({ type: IMPORT_FOLLOWS_REQUEST });
|
|
|
|
return api(getState)
|
2020-09-19 16:32:43 -07:00
|
|
|
.post('/api/pleroma/follow_import', params)
|
2020-09-14 20:07:33 -07:00
|
|
|
.then(response => {
|
2020-09-19 16:32:43 -07:00
|
|
|
dispatch(showAlert('', 'Successful import'));
|
2020-09-14 20:07:33 -07:00
|
|
|
dispatch({ type: IMPORT_FOLLOWS_SUCCESS, config: response.data });
|
|
|
|
}).catch(error => {
|
|
|
|
dispatch({ type: IMPORT_FOLLOWS_FAIL, error });
|
|
|
|
});
|
|
|
|
};
|
|
|
|
}
|