Add folder and post details fetching in ManagePage; implement delete confirmation modal for folders with recursive deletion option in API.
This commit is contained in:
@@ -5,7 +5,7 @@ import path from 'path';
|
||||
export async function POST(request: NextRequest) {
|
||||
try {
|
||||
const body = await request.json();
|
||||
const { path: itemPath, name, type } = body;
|
||||
const { path: itemPath, name, type, recursive } = body;
|
||||
|
||||
if (!name || !type) {
|
||||
return NextResponse.json(
|
||||
@@ -58,8 +58,8 @@ export async function POST(request: NextRequest) {
|
||||
}, { status: 404 });
|
||||
}
|
||||
|
||||
// For folders, check if it's empty
|
||||
if (type === 'folder') {
|
||||
// For folders, check if it's empty unless recursive is true
|
||||
if (type === 'folder' && !recursive) {
|
||||
try {
|
||||
const files = await fs.readdir(fullPath);
|
||||
if (files.length > 0) {
|
||||
|
||||
Reference in New Issue
Block a user