This commit is contained in:
mgabdev
2020-02-19 18:57:07 -05:00
parent be3daea78b
commit e37500c0cf
105 changed files with 1975 additions and 1393 deletions

View File

@@ -81,13 +81,17 @@ export const fetchListFail = (id, error) => ({
});
export const fetchLists = () => (dispatch, getState) => {
if (!me) return;
dispatch(fetchListsRequest());
api(getState).get('/api/v1/lists')
.then(({ data }) => dispatch(fetchListsSuccess(data)))
.catch(err => dispatch(fetchListsFail(err)));
return new Promise((resolve, reject) => {
dispatch(fetchListsRequest());
if (!me) return reject()
api(getState).get('/api/v1/lists').then(({ data }) => {
dispatch(fetchListsSuccess(data))
return resolve()
}).catch((err) => {
dispatch(fetchListsFail(err))
return reject()
});
})
};
export const fetchListsRequest = () => ({