MCPcopy
hub / github.com/JoelOtter/kajero / loadMarkdown

Function loadMarkdown

src/js/actions.js:45–67  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

43}
44
45export function loadMarkdown() {
46 const queryParams = parse(location.search);
47 if (queryParams.id) {
48 const url = gistUrl + queryParams.id + '/raw';
49 return (dispatch, getState) => {
50 return fetch(url, {
51 method: 'get'
52 })
53 .then(checkStatus)
54 .then(response => response.text())
55 .then(md => dispatch({
56 type: LOAD_MARKDOWN,
57 markdown: md
58 }))
59 .then(() => dispatch(fetchData()))
60 .catch(() => {
61 dispatch(loadMarkdownFromHTML());
62 dispatch(fetchData());
63 })
64 };
65 }
66 return loadMarkdownFromHTML();
67}
68
69function loadMarkdownFromHTML() {
70 return {

Callers 1

componentWillMountMethod · 0.90

Calls 3

parseFunction · 0.85
fetchDataFunction · 0.85
loadMarkdownFromHTMLFunction · 0.85

Tested by

no test coverage detected