Skip to content

Commit a48c133

Browse files
committed
add parsing of the github api key
Signed-off-by: Isaac Milarsky <imilarsky@gmail.com>
1 parent ecc7a78 commit a48c133

2 files changed

Lines changed: 18 additions & 19 deletions

File tree

js/formDataToJson.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ async function createCodeJson(data) {
7878
delete data.submit;
7979
const codeJson = await populateCodeJson(data);
8080

81+
window.gh_api_key = data['gh_api_key']
82+
console.log("TEST")
83+
console.log(window.gh_api_key)
84+
8185
const jsonString = JSON.stringify(codeJson, null, 2);
8286
document.getElementById("json-result").value = jsonString;
8387
}
@@ -96,8 +100,19 @@ async function createProjectPR(event){
96100
event.preventDefault();
97101

98102
var textArea = document.getElementById("json-result");
99-
var codeJSONObj = textArea.value.parse()
100-
console.log(codeJSONObj)
103+
var codeJSONObj = JSON.parse(textArea.value)
104+
105+
if('gh_api_key' in window)
106+
{
107+
var apiKey = window.gh_api_key
108+
console.log(apiKey)
109+
}
110+
else
111+
{
112+
console.error("No API key found!")
113+
alert("No Api Key in submitted data!")
114+
}
115+
//console.log(codeJSONObj)
101116
}
102117

103118
// Triggers local file download

js/generateFormComponents.js

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ async function createFormComponents() {
300300
"label": "GitHub API Key (optional)",
301301
"disableSortingAndFiltering": false,
302302
"tableView": true,
303-
"key": "textField",
303+
"key": "gh_api_key",
304304
"type": "textfield",
305305
"input": true
306306
});
@@ -317,22 +317,6 @@ async function createFormComponents() {
317317

318318

319319

320-
321-
// Add Create PR button to form
322-
// Add submit button to form
323-
/*
324-
components.push({
325-
type: "button",
326-
label: "Generate code.json metadata and push to Repository",
327-
key: "submit",
328-
disableOnInvalid: false,
329-
input: true,
330-
tableView: false,
331-
});
332-
*/
333-
334-
335-
336320
console.log(components);
337321

338322
return components;

0 commit comments

Comments
 (0)