refactor: Add CreateForm to write comments

This commit is contained in:
2024-06-21 12:39:37 +04:00
parent def7dd60db
commit 6870f1e459
5 changed files with 180 additions and 112 deletions
+14
View File
@@ -24,3 +24,17 @@ export function formatDate(date, formatStr = 'PP') {
locale: fr
})
}
export function hasRestrictedChar(text) {
const regex = /[<>&"]/g
return Boolean(regex.test(text))
}
export function formatFormContent(currentTarget) {
const formData = new FormData(currentTarget)
const formJson = Object.fromEntries(formData.entries())
const {content} = formJson
return content.replaceAll('\'', '')
}