mirror of
https://github.com/d0zingcat/alert-message-center.git
synced 2026-05-22 15:09:45 +00:00
@@ -1,28 +1,30 @@
|
||||
export { };
|
||||
export {};
|
||||
|
||||
// Simulate admin checking requests
|
||||
async function run() {
|
||||
console.log('Fetching pending topics as admin...');
|
||||
const adminEmail = (process.env.ADMIN_EMAILS || '').split(',')[0].trim();
|
||||
const res = await fetch('http://localhost:3000/api/topics/requests', {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Cookie': `session=${encodeURIComponent(JSON.stringify({
|
||||
id: 'admin_123',
|
||||
name: 'Admin User',
|
||||
email: adminEmail,
|
||||
isAdmin: true
|
||||
}))}`
|
||||
}
|
||||
});
|
||||
console.log("Fetching pending topics as admin...");
|
||||
const adminEmail = (process.env.ADMIN_EMAILS || "").split(",")[0].trim();
|
||||
const res = await fetch("http://localhost:3000/api/topics/requests", {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Cookie: `session=${encodeURIComponent(
|
||||
JSON.stringify({
|
||||
id: "admin_123",
|
||||
name: "Admin User",
|
||||
email: adminEmail,
|
||||
isAdmin: true,
|
||||
}),
|
||||
)}`,
|
||||
},
|
||||
});
|
||||
|
||||
if (res.ok) {
|
||||
const data = await res.json();
|
||||
console.log('Pending topics:', JSON.stringify(data, null, 2));
|
||||
} else {
|
||||
console.log('Error:', res.status, await res.text());
|
||||
}
|
||||
if (res.ok) {
|
||||
const data = await res.json();
|
||||
console.log("Pending topics:", JSON.stringify(data, null, 2));
|
||||
} else {
|
||||
console.log("Error:", res.status, await res.text());
|
||||
}
|
||||
}
|
||||
|
||||
run();
|
||||
|
||||
Reference in New Issue
Block a user