Skip to content

Commit

Permalink
change examples to use safe data handling (#483)
Browse files Browse the repository at this point in the history
  • Loading branch information
elb-notion committed Jan 19, 2024
1 parent 4477298 commit b66c67d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions examples/web-form-with-express/public/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ const appendApiResponse = function (apiResponse, el) {

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

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

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

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

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

Expand Down

1 comment on commit b66c67d

@Sholman81
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.