diff --git a/app/soapbox/actions/__tests__/about-test.js b/app/soapbox/actions/__tests__/about-test.js
index 73c7b5d4f..19fa9bcad 100644
--- a/app/soapbox/actions/__tests__/about-test.js
+++ b/app/soapbox/actions/__tests__/about-test.js
@@ -17,7 +17,7 @@ describe('fetchAboutPage()', () => {
const expectedActions = [
{ type: FETCH_ABOUT_PAGE_REQUEST, slug: 'index' },
- { type: FETCH_ABOUT_PAGE_SUCCESS, slug: 'index' },
+ { type: FETCH_ABOUT_PAGE_SUCCESS, slug: 'index', html: '
Hello world
' },
];
const store = mockStore(ImmutableMap());
@@ -29,11 +29,11 @@ describe('fetchAboutPage()', () => {
it('creates the expected actions on failure', () => {
const expectedActions = [
{ type: FETCH_ABOUT_PAGE_REQUEST, slug: 'asdf' },
- { type: FETCH_ABOUT_PAGE_FAIL, slug: 'asdf' },
+ { type: FETCH_ABOUT_PAGE_FAIL, slug: 'asdf', error: new Error('Request failed with status code 404') },
];
const store = mockStore(ImmutableMap());
- return store.dispatch(fetchAboutPage('asdf')).then(() => {
+ return store.dispatch(fetchAboutPage('asdf')).catch(() => {
expect(store.getActions()).toEqual(expectedActions);
});
});
diff --git a/app/soapbox/actions/about.js b/app/soapbox/actions/about.js
index 81c162b6b..a515bdfbb 100644
--- a/app/soapbox/actions/about.js
+++ b/app/soapbox/actions/about.js
@@ -7,10 +7,12 @@ export const FETCH_ABOUT_PAGE_FAIL = 'FETCH_ABOUT_PAGE_FAIL';
export function fetchAboutPage(slug = 'index') {
return (dispatch, getState) => {
dispatch({ type: FETCH_ABOUT_PAGE_REQUEST, slug });
- return api(getState).get(`/instance/about/${slug}.html`).then(() => {
- dispatch({ type: FETCH_ABOUT_PAGE_SUCCESS, slug });
+ return api(getState).get(`/instance/about/${slug}.html`).then(response => {
+ dispatch({ type: FETCH_ABOUT_PAGE_SUCCESS, slug, html: response.data });
+ return response.data;
}).catch(error => {
- dispatch({ type: FETCH_ABOUT_PAGE_FAIL, slug });
+ dispatch({ type: FETCH_ABOUT_PAGE_FAIL, slug, error });
+ throw error;
});
};
}
diff --git a/app/soapbox/features/about/index.js b/app/soapbox/features/about/index.js
index de2475eac..55d716878 100644
--- a/app/soapbox/features/about/index.js
+++ b/app/soapbox/features/about/index.js
@@ -12,8 +12,8 @@ class AboutPage extends ImmutablePureComponent {
loadPageHtml = () => {
const { dispatch, match } = this.props;
const { slug } = match.params;
- dispatch(fetchAboutPage(slug)).then(response => {
- this.setState({ pageHtml: response.data });
+ dispatch(fetchAboutPage(slug)).then(html => {
+ this.setState({ pageHtml: html });
}).catch(error => {
// TODO: Better error handling. 404 page?
this.setState({ pageHtml: 'Page not found
' });