更新 CNB 配置获取逻辑,修复未授权问题,添加测试文件
This commit is contained in:
@@ -9,7 +9,7 @@ app.route({
|
||||
middleware: ['auth'],
|
||||
|
||||
}).define(async (ctx) => {
|
||||
const tokenUser = ctx.tokenUser;
|
||||
const tokenUser = ctx.state?.tokenUser;
|
||||
if (!tokenUser) {
|
||||
ctx.throw(401, '未授权');
|
||||
}
|
||||
@@ -29,7 +29,8 @@ app.route({
|
||||
description: '获取我的cnb配置',
|
||||
middleware: ['auth'],
|
||||
}).define(async (ctx) => {
|
||||
const username = ctx.tokenUser?.username;
|
||||
const tokenUser = ctx.state?.tokenUser;
|
||||
const username = tokenUser?.username;
|
||||
const token = ctx.query?.token;
|
||||
if (!username) {
|
||||
ctx.throw(400, '未授权');
|
||||
|
||||
Reference in New Issue
Block a user