fetchMastoPreferences() action for pulling /api/v1/preferences
This commit is contained in:
parent
c40fb925e9
commit
24810f83c0
1 changed files with 23 additions and 0 deletions
23
app/gabsocial/actions/preferences.js
Normal file
23
app/gabsocial/actions/preferences.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
import api from '../api';
|
||||
|
||||
export const MASTO_PREFS_FETCH_SUCCESS = 'MASTO_PREFS_FETCH_SUCCESS';
|
||||
|
||||
export const FE_NAME = 'soapbox_fe';
|
||||
|
||||
export function fetchMastoPreferences() {
|
||||
return (dispatch, getState) => {
|
||||
api(getState).get('/api/v1/preferences').then(response => {
|
||||
dispatch(mastoFetchPrefsSuccess(response.data));
|
||||
}).catch(e => {
|
||||
console.error(e);
|
||||
console.error('Could not fetch Mastodon preferences.');
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
export function mastoFetchPrefsSuccess(prefs) {
|
||||
return {
|
||||
type: MASTO_PREFS_FETCH_SUCCESS,
|
||||
prefs,
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue