tagid instead of tagname
This commit is contained in:
@ -136,7 +136,7 @@ export default (router, tpl) => {
|
||||
});
|
||||
|
||||
group.post(/\/admin\/tags\/delete$/, auth, async (req, res) => {
|
||||
if(!req.post.postid || !req.post.tag) {
|
||||
if(!req.post.postid || !req.post.tagid) {
|
||||
return res.reply({ body: JSON.stringify({
|
||||
success: false,
|
||||
msg: "missing postid or tag"
|
||||
@ -144,15 +144,14 @@ export default (router, tpl) => {
|
||||
}
|
||||
|
||||
const postid = +req.post.postid;
|
||||
const tag = req.post.tag;
|
||||
const tagid = +req.post.tagid;
|
||||
|
||||
const tags = await lib.getTags(postid);
|
||||
|
||||
const tagid = tags.filter(t => t.tag === tag)[0]?.id ?? null;
|
||||
if(!tagid || tagid?.length === 0) {
|
||||
const tagcheck = tags.filter(t => t.id === tagid)[0]?.id ?? null;
|
||||
if(!tagcheck || !tagid || tagid?.length === 0) {
|
||||
return res.reply({ body: JSON.stringify({
|
||||
success: false,
|
||||
tag: tag,
|
||||
msg: "tag is not assigned",
|
||||
tags: await lib.getTags(postid)
|
||||
})});
|
||||
@ -165,7 +164,6 @@ export default (router, tpl) => {
|
||||
|
||||
return res.reply({ body: JSON.stringify({
|
||||
success: reply,
|
||||
tag: tag,
|
||||
tagid: tagid,
|
||||
tags: await lib.getTags(postid)
|
||||
})});
|
||||
|
Reference in New Issue
Block a user