24 lines
798 B
JavaScript
24 lines
798 B
JavaScript
const base = 'http://127.0.0.1:5000';
|
|
|
|
(async () => {
|
|
const profileRes = await fetch(`${base}/api/profile?email=admin@example.com`);
|
|
const profileData = await profileRes.json();
|
|
const adminId = profileData.profile && profileData.profile.id;
|
|
if (!adminId) throw new Error('admin profile not found');
|
|
const token = `token-admin-${adminId}-${Date.now()}`;
|
|
|
|
const res = await fetch(`${base}/api/gallery`, {
|
|
method: 'DELETE',
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
Authorization: `Bearer ${token}`,
|
|
},
|
|
body: JSON.stringify({ ids: ['00000000-0000-0000-0000-000000000000'] }),
|
|
});
|
|
const body = await res.text();
|
|
console.log(JSON.stringify({ status: res.status, body }, null, 2));
|
|
})().catch((error) => {
|
|
console.error(error);
|
|
process.exit(1);
|
|
});
|