修改接口的验证方式
This commit is contained in:
parent
be30ef7e3e
commit
a9445be97b
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user