trim tags
This commit is contained in:
parent
236c4790bc
commit
29ad6c5773
|
@ -118,7 +118,7 @@ const flash = ({ type, msg }) => {
|
||||||
let tt;
|
let tt;
|
||||||
input.addEventListener("keydown", async e => {
|
input.addEventListener("keydown", async e => {
|
||||||
if(e.key === "Enter") {
|
if(e.key === "Enter") {
|
||||||
const tmptag = input.value;
|
const tmptag = input.value?.trim();
|
||||||
if(tags.includes(tmptag))
|
if(tags.includes(tmptag))
|
||||||
return alert("tag already exists");
|
return alert("tag already exists");
|
||||||
const res = await addTag(postid, tmptag);
|
const res = await addTag(postid, tmptag);
|
||||||
|
|
|
@ -94,7 +94,7 @@ export default (router, tpl) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const postid = +req.post.postid;
|
const postid = +req.post.postid;
|
||||||
const tag = req.post.tag;
|
const tag = req.post.tag?.trim();
|
||||||
|
|
||||||
if(tag.length >= 45) {
|
if(tag.length >= 45) {
|
||||||
return res.reply({ body: JSON.stringify({
|
return res.reply({ body: JSON.stringify({
|
||||||
|
|
Loading…
Reference in New Issue
Block a user