diff --git a/src/plugins/apiauth.ts b/src/plugins/apiauth.ts index 8ff5f03..7f5b0bd 100644 --- a/src/plugins/apiauth.ts +++ b/src/plugins/apiauth.ts @@ -27,12 +27,12 @@ const apiAuthPlugin: FastifyPluginAsync = async function (fastif if (!request.roles || request.roles.indexOf('anon') == -1) { try { if (!request.token) { - return reply.send({ code: 11, msg: 'need login' }) + return reply.send({ errcode: 11, errmsg: 'need login' }) } //@ts-ignore const data = this.jwt.verify(request.token) if (!data || !data.id) { - return reply.send({ code: 10, msg: 'need login' }) + return reply.send({ errcode: 10, errmsg: 'need login' }) } // let account = await Account.findById(data.id) // if (!account) { @@ -40,7 +40,7 @@ const apiAuthPlugin: FastifyPluginAsync = async function (fastif // } // request.user = account } catch (err) { - return reply.send({ code: 401, msg: 'need auth' }) + return reply.send({ errcode: 401, errmsg: 'need auth' }) } } })