main
Some checks failed
UI Deploy (Next-Auth Support) 🎨 / build-and-deploy (push) Has been cancelled

This commit is contained in:
Harun CAN
2026-04-05 20:37:03 +03:00
parent d8f9865dcf
commit dd8878d403
10 changed files with 767 additions and 285 deletions

31
test-fe-api.js Normal file
View File

@@ -0,0 +1,31 @@
const axios = require('axios');
async function test() {
const login = await axios.post('http://localhost:3000/api/auth/login', {
email: 'admin@contentgen.ai',
password: 'Admin123!',
});
const token = login.data.data.accessToken;
// Simulate interceptor
let responseData = await axios.get('http://localhost:3000/api/projects', {
headers: { Authorization: `Bearer ${token}` }
}).then(r => {
let data = r.data;
if (data && typeof data === 'object' && 'success' in data && 'data' in data) {
data = data.data;
}
return data;
});
console.log("Interceptor Output:", JSON.stringify(responseData, null, 2).substring(0, 500));
const raw = responseData;
const rawProjects = raw?.data ?? raw ?? [];
const projects = Array.isArray(rawProjects) ? rawProjects : [];
console.log("Is array?", Array.isArray(rawProjects));
console.log("Projects length:", projects.length);
}
test();