Skip to content

Commit b66c67d

Browse files
authored
change examples to use safe data handling (#483)
1 parent 4477298 commit b66c67d

File tree

1 file changed

+4
-4
lines changed
  • examples/web-form-with-express/public

1 file changed

+4
-4
lines changed

examples/web-form-with-express/public/client.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ const appendApiResponse = function (apiResponse, el) {
2626

2727
// Add success message to UI
2828
const newParagraphSuccessMsg = document.createElement("p")
29-
newParagraphSuccessMsg.innerHTML = "Result: " + apiResponse.message
29+
newParagraphSuccessMsg.textContent = "Result: " + apiResponse.message
3030
el.appendChild(newParagraphSuccessMsg)
3131
// See browser console for more information
3232
if (apiResponse.message === "error") return
3333

3434
// Add ID of Notion item (db, page, comment) to UI
3535
const newParagraphId = document.createElement("p")
36-
newParagraphId.innerHTML = "ID: " + apiResponse.data.id
36+
newParagraphId.textContent = "ID: " + apiResponse.data.id
3737
el.appendChild(newParagraphId)
3838

3939
// Add URL of Notion item (db, page) to UI
@@ -51,12 +51,12 @@ const appendBlocksResponse = function (apiResponse, el) {
5151

5252
// Add success message to UI
5353
const newParagraphSuccessMsg = document.createElement("p")
54-
newParagraphSuccessMsg.innerHTML = "Result: " + apiResponse.message
54+
newParagraphSuccessMsg.textContent = "Result: " + apiResponse.message
5555
el.appendChild(newParagraphSuccessMsg)
5656

5757
// Add block ID to UI
5858
const newParagraphId = document.createElement("p")
59-
newParagraphId.innerHTML = "ID: " + apiResponse.data.results[0].id
59+
newParagraphId.textContent = "ID: " + apiResponse.data.results[0].id
6060
el.appendChild(newParagraphId)
6161
}
6262

0 commit comments

Comments
 (0)