2021-09-05 11:16:19 -07:00
|
|
|
import { staticClient } from '../api';
|
2020-04-25 14:10:01 -07:00
|
|
|
|
|
|
|
export const FETCH_ABOUT_PAGE_REQUEST = 'FETCH_ABOUT_PAGE_REQUEST';
|
2020-06-09 14:47:41 -07:00
|
|
|
export const FETCH_ABOUT_PAGE_SUCCESS = 'FETCH_ABOUT_PAGE_SUCCESS';
|
2020-04-25 14:10:01 -07:00
|
|
|
export const FETCH_ABOUT_PAGE_FAIL = 'FETCH_ABOUT_PAGE_FAIL';
|
|
|
|
|
2021-06-26 06:07:45 -07:00
|
|
|
export function fetchAboutPage(slug = 'index', locale) {
|
2020-04-25 14:10:01 -07:00
|
|
|
return (dispatch, getState) => {
|
2021-06-26 06:07:45 -07:00
|
|
|
dispatch({ type: FETCH_ABOUT_PAGE_REQUEST, slug, locale });
|
2021-09-05 11:16:19 -07:00
|
|
|
const filename = `${slug}${locale ? `.${locale}` : ''}.html`;
|
|
|
|
return staticClient.get(`/instance/about/${filename}`).then(({ data: html }) => {
|
|
|
|
dispatch({ type: FETCH_ABOUT_PAGE_SUCCESS, slug, locale, html });
|
|
|
|
return html;
|
2020-06-09 14:47:41 -07:00
|
|
|
}).catch(error => {
|
2021-06-26 06:07:45 -07:00
|
|
|
dispatch({ type: FETCH_ABOUT_PAGE_FAIL, slug, locale, error });
|
2020-06-12 12:39:56 -07:00
|
|
|
throw error;
|
2020-04-25 14:10:01 -07:00
|
|
|
});
|
|
|
|
};
|
|
|
|
}
|