修改接口的验证方式

This commit is contained in:
zhl 2021-01-13 15:47:31 +08:00
parent be30ef7e3e
commit a9445be97b

View File

@ -28,7 +28,7 @@ const apiAuthPlugin: FastifyPluginAsync = async function(
fastify.decorate("apiAuth", async function(request: FastifyRequest, reply: FastifyReply) { fastify.decorate("apiAuth", async function(request: FastifyRequest, reply: FastifyReply) {
if (!request.roles || request.roles.indexOf('anon') == -1) { if (!request.roles || request.roles.indexOf('anon') == -1) {
try { try {
if (request.roles.indexOf('svr') >= 0) { if (request.roles && request.roles.indexOf('svr') >= 0) {
// TODO: check svr // TODO: check svr
} else { } else {
// @ts-ignore // @ts-ignore