Some checks failed
Deploy / deploy (push) Has been cancelled
Full-stack web application for Telegram management - Frontend: Vue 3 + Vben Admin - Backend: NestJS - Features: User management, group broadcast, statistics 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
40 lines
1.1 KiB
JavaScript
40 lines
1.1 KiB
JavaScript
const axios = require('axios');
|
|
|
|
async function test() {
|
|
try {
|
|
// 先登录获取token
|
|
console.log('1. 登录获取token...');
|
|
const loginRes = await axios.post('http://localhost:3000/login', {
|
|
account: 'admin',
|
|
password: '111111'
|
|
});
|
|
|
|
console.log('登录响应:', loginRes.data);
|
|
|
|
if (loginRes.data.success) {
|
|
const token = loginRes.data.data;
|
|
console.log('获取到token:', token);
|
|
|
|
// 使用token调用/admin/info
|
|
console.log('\n2. 调用/admin/info接口...');
|
|
const adminInfoRes = await axios.post('http://localhost:3000/admin/info', {}, {
|
|
headers: {
|
|
'token': token,
|
|
'Content-Type': 'application/x-www-form-urlencoded'
|
|
}
|
|
});
|
|
|
|
console.log('Admin info响应状态:', adminInfoRes.status);
|
|
console.log('Admin info响应数据:', adminInfoRes.data);
|
|
}
|
|
} catch (error) {
|
|
console.error('错误:', error.response?.data || error.message);
|
|
if (error.response) {
|
|
console.error('响应状态:', error.response.status);
|
|
console.error('响应头:', error.response.headers);
|
|
}
|
|
}
|
|
}
|
|
|
|
test();
|