feat: Cập nhật các thành phần UI với cấu trúc dựa trên tính năng, thêm các thành phần glassmorphism, và cải thiện cấu hình đường dẫn trong tsconfig.
This commit is contained in:
80
apps/client-example/scripts/developers/test-ppoint-direct.js
Normal file
80
apps/client-example/scripts/developers/test-ppoint-direct.js
Normal file
@@ -0,0 +1,80 @@
|
||||
// Test PPoint Service trực tiếp với token có sẵn
|
||||
// Chạy trong browser console tại http://localhost:3001
|
||||
|
||||
console.log('🧪 Testing PPoint Service with existing token...');
|
||||
|
||||
// Kiểm tra token
|
||||
const token = localStorage.getItem('auth_token');
|
||||
console.log('🔍 Token status:', token ? '✅ Found' : '❌ Missing');
|
||||
|
||||
if (!token) {
|
||||
console.error('❌ No token found! Please login first.');
|
||||
return;
|
||||
}
|
||||
|
||||
// Test API trực tiếp
|
||||
async function testPPointAPI() {
|
||||
try {
|
||||
console.log('🔍 Testing API endpoints directly...');
|
||||
|
||||
// Test balance endpoint
|
||||
const balanceResponse = await fetch('http://localhost:7009/api/points/balance', {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': `Bearer ${token}`
|
||||
}
|
||||
});
|
||||
|
||||
console.log('💰 Balance API Status:', balanceResponse.status);
|
||||
if (balanceResponse.ok) {
|
||||
const balanceData = await balanceResponse.json();
|
||||
console.log('✅ Balance API working!', balanceData);
|
||||
} else {
|
||||
const errorData = await balanceResponse.json();
|
||||
console.error('❌ Balance API error:', errorData);
|
||||
}
|
||||
|
||||
// Test daily points status
|
||||
const dailyResponse = await fetch('http://localhost:7009/api/daily-points/status', {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': `Bearer ${token}`
|
||||
}
|
||||
});
|
||||
|
||||
console.log('📅 Daily Points API Status:', dailyResponse.status);
|
||||
if (dailyResponse.ok) {
|
||||
const dailyData = await dailyResponse.json();
|
||||
console.log('✅ Daily Points API working!', dailyData);
|
||||
} else {
|
||||
const errorData = await dailyResponse.json();
|
||||
console.error('❌ Daily Points API error:', errorData);
|
||||
}
|
||||
|
||||
// Test transaction history
|
||||
const historyResponse = await fetch('http://localhost:7009/api/points/history?offset=0&limit=10', {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': `Bearer ${token}`
|
||||
}
|
||||
});
|
||||
|
||||
console.log('📊 History API Status:', historyResponse.status);
|
||||
if (historyResponse.ok) {
|
||||
const historyData = await historyResponse.json();
|
||||
console.log('✅ History API working!', historyData);
|
||||
} else {
|
||||
const errorData = await historyResponse.json();
|
||||
console.error('❌ History API error:', errorData);
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('❌ Test error:', error);
|
||||
}
|
||||
}
|
||||
|
||||
// Run test
|
||||
testPPointAPI();
|
||||
Reference in New Issue
Block a user