From b66c67dbdadc7c72312869311ea735063db758b1 Mon Sep 17 00:00:00 2001 From: elb-notion <148162172+elb-notion@users.noreply.github.com> Date: Fri, 19 Jan 2024 10:21:10 -0800 Subject: [PATCH] change examples to use safe data handling (#483) --- examples/web-form-with-express/public/client.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/web-form-with-express/public/client.js b/examples/web-form-with-express/public/client.js index 0cc9ddc2..9eb90151 100644 --- a/examples/web-form-with-express/public/client.js +++ b/examples/web-form-with-express/public/client.js @@ -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 @@ -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) }