remove tag functionality
This commit is contained in:
@@ -17,9 +17,9 @@ export default async function users(req: NextApiRequest, res: NextApiResponse) {
|
||||
|
||||
let PRICE_ID = MONTHLY_PRICE_ID;
|
||||
|
||||
if ((Number(req.query.plan) as unknown as Plan) === Plan.monthly)
|
||||
if ((Number(req.query.plan) as Plan) === Plan.monthly)
|
||||
PRICE_ID = MONTHLY_PRICE_ID;
|
||||
else if ((Number(req.query.plan) as unknown as Plan) === Plan.yearly)
|
||||
else if ((Number(req.query.plan) as Plan) === Plan.yearly)
|
||||
PRICE_ID = YEARLY_PRICE_ID;
|
||||
|
||||
if (req.method === "GET") {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { NextApiRequest, NextApiResponse } from "next";
|
||||
import updateTag from "@/lib/api/controllers/tags/tagId/updeteTagById";
|
||||
import updeteTagById from "@/lib/api/controllers/tags/tagId/updeteTagById";
|
||||
import authenticateUser from "@/lib/api/authenticateUser";
|
||||
import deleteTagById from "@/lib/api/controllers/tags/tagId/deleteTagById";
|
||||
|
||||
export default async function tags(req: NextApiRequest, res: NextApiResponse) {
|
||||
const user = await authenticateUser({ req, res });
|
||||
@@ -9,7 +10,10 @@ export default async function tags(req: NextApiRequest, res: NextApiResponse) {
|
||||
const tagId = Number(req.query.id);
|
||||
|
||||
if (req.method === "PUT") {
|
||||
const tags = await updateTag(user.id, tagId, req.body);
|
||||
const tags = await updeteTagById(user.id, tagId, req.body);
|
||||
return res.status(tags.status).json({ response: tags.response });
|
||||
} else if (req.method === "DELETE") {
|
||||
const tags = await deleteTagById(user.id, tagId);
|
||||
return res.status(tags.status).json({ response: tags.response });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user