Skip to content
This repository was archived by the owner on May 1, 2025. It is now read-only.

Commit 8d2a9c6

Browse files
committed
Fixed duplicatation alert in thunks
1 parent 45f9f3d commit 8d2a9c6

File tree

2 files changed

+18
-15
lines changed

2 files changed

+18
-15
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/), and this
77
**Table of Contents**
88

99
- [[Unreleased]](#unreleased)
10-
- [[1.4.2] - (2020-12-04)](#142---2020-12-04)
10+
- [[1.4.2] - (2020-12-18)](#142---2020-12-18)
1111
- [[v1.4.1] - (2020-12-03)](#v141---2020-12-03)
1212
- [Added](#added)
1313
- [Fixed](#fixed)
@@ -43,7 +43,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/), and this
4343

4444
---
4545

46-
## [1.4.2] - (2020-12-04)
46+
## [1.4.2] - (2020-12-18)
4747

4848
---
4949

website/src/Redux/thunks/docs.thunks.ts

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,7 @@ export const getDocs = (docType: DocType) => async (
7474

7575
const res = await fetch(data.download_url);
7676
const text = await res.text();
77-
const { data: docs } = await octokit.markdown.render({
78-
text: text,
79-
mode: "gfm",
80-
context: "YashTotale/react-hash-scroll",
81-
mediaType: { format: "html" },
82-
});
77+
const docs = await markdownToHtml(text);
8378

8479
dispatch(loadDocsSuccess(docType, docs));
8580
} catch (e) {
@@ -114,14 +109,9 @@ const getComponentsRequest = () => async (
114109
const res = await fetch(download_url);
115110
const text = await res.text();
116111

117-
const id = name.slice(0, -3);
112+
const html = await markdownToHtml(text);
118113

119-
const { data: html } = await octokit.markdown.render({
120-
text,
121-
mode: "gfm",
122-
context: "YashTotale/react-hash-scroll",
123-
mediaType: { format: "html" },
124-
});
114+
const id = name.slice(0, -3);
125115

126116
components[id] = {
127117
text: html,
@@ -175,6 +165,19 @@ export const onDemandDataRequest = (page: DocType | null) => async (
175165
}
176166
};
177167

168+
const markdownToHtml = async (md: string) => {
169+
const octokit = new Octokit();
170+
171+
const { data } = await octokit.markdown.render({
172+
text: md,
173+
mode: "gfm",
174+
context: "YashTotale/react-hash-scroll",
175+
mediaType: { format: "html" },
176+
});
177+
178+
return data;
179+
};
180+
178181
const getFuncsForDocType = (docType: DocType) => {
179182
switch (docType) {
180183
case "readme": {

0 commit comments

Comments
 (0)