Skip to content

Commit 4791164

Browse files
committed
Completed frontend changes for new functionality
1 parent ddf0853 commit 4791164

File tree

6 files changed

+8378
-9428
lines changed

6 files changed

+8378
-9428
lines changed

content/posts/2020-06-09--Void/index.mdx

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ tags:
66
---
77
import P5 from "./void"
88

9+
## Peer within
10+
911
<P5 />
1012

1113

content/posts/2022-01-08--Md2ssml/convert.js

+12-13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React, { useState, useEffect, useCallback } from "react";
22
import debounce from 'lodash.debounce';
3+
import axios from 'axios';
34

45
/*
56
* @author Blake Vente
@@ -9,11 +10,12 @@ import debounce from 'lodash.debounce';
910
const ENDPOINT = process.env.GATSBY_PANDOC_ENDPOINT;
1011
const MARKUP = "# edit me! \n## numbered list example \n1. first item\n2. second item";
1112

12-
13+
// styles
1314
const darkBackground = {
1415
color: "rgb(214, 222, 235)",
1516
backgroundColor: "rgb(1, 22, 39)",
1617
};
18+
1719
const inputField = {
1820
width: "100%",
1921
height: "400px",
@@ -29,24 +31,21 @@ const breakStyle = {
2931
};
3032

3133
export default function Convert() {
32-
var myHeaders = new Headers();
33-
myHeaders.append("Content-Type", "application/json");
34-
3534
const [convertReponse, setConvertResponse] = useState("");
3635
const [markupRequest, setMarkupRequest] = useState(MARKUP);
3736

37+
3838
const HitConvertEndpoint = async (r) => {
39-
const requestOptions = {
40-
method: 'POST',
41-
headers: myHeaders,
42-
body: JSON.stringify({ "markup": r }),
43-
redirect: 'follow'
44-
};
45-
const res = await fetch(ENDPOINT, requestOptions)
46-
.then(response => response.text())
39+
const res = await axios.post(ENDPOINT, {"markup": r}, {
40+
headers: {
41+
"Content-Type": "application/json"
42+
}
43+
})
44+
.then(response => response?.data)
45+
.then(response => {console.log(response); return response})
4746
.catch(error => console.log('error', error));
4847

49-
setConvertResponse(JSON.parse(res)?.result);
48+
setConvertResponse(res.result);
5049
};
5150

5251
const handleInputChange = (e) => {

content/posts/2022-01-08--Md2ssml/index.mdx

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ tags:
66
---
77
import Convert from "./convert"
88

9+
Try out my api for converting markdown to ssml.
10+
911
<Convert />
1012

1113

0 commit comments

Comments
 (0)