mirror of
https://github.com/koreanbots/core.git
synced 2025-12-16 06:20:24 +00:00
fix: invalid v1 api
This commit is contained in:
parent
869caea735
commit
85560c2421
@ -9,7 +9,7 @@ const BotVoted = RequestHandler()
|
|||||||
.get(async (req: ApiRequest, res) => {
|
.get(async (req: ApiRequest, res) => {
|
||||||
const bot = await get.BotAuthorization(req.headers.token)
|
const bot = await get.BotAuthorization(req.headers.token)
|
||||||
if(!bot) return ResponseWrapper(res, { code: 401, version: 1 })
|
if(!bot) return ResponseWrapper(res, { code: 401, version: 1 })
|
||||||
if(req.query.botID !== bot) return ResponseWrapper(res, { code: 403, version: 1 })
|
if(req.query.id !== bot) return ResponseWrapper(res, { code: 403, version: 1 })
|
||||||
const userID = await Yup.string().required().validate(req.query.id).then(el => el).catch(() => null)
|
const userID = await Yup.string().required().validate(req.query.id).then(el => el).catch(() => null)
|
||||||
if(!userID) return ResponseWrapper(res, { code: 400, version: 1 })
|
if(!userID) return ResponseWrapper(res, { code: 400, version: 1 })
|
||||||
const result = await get.botVote(userID, bot)
|
const result = await get.botVote(userID, bot)
|
||||||
@ -21,7 +21,6 @@ interface ApiRequest extends NextApiRequest {
|
|||||||
token: string
|
token: string
|
||||||
}
|
}
|
||||||
query: {
|
query: {
|
||||||
botID: string
|
|
||||||
id: string
|
id: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user