diff --git a/frontend/app/api/admin/collections-requests/route.ts b/frontend/app/api/admin/collections-requests/route.ts index 2e16412..84dcfa1 100644 --- a/frontend/app/api/admin/collections-requests/route.ts +++ b/frontend/app/api/admin/collections-requests/route.ts @@ -10,18 +10,18 @@ export async function GET(request: NextRequest) { { db: { schema: 'public' } }, ); - // Retrieve the public collections requests data from the database - const { data: pubCollectionsReq, error: pubCollErr } = await supabase + // Retrieve the collections requests data from the database + const { data: collectionsReq, error: collErr } = await supabase .from('collections_requests') .select('collection_id, is_make_public, is_pending, is_approved, created_at, updated_at, collections (collection_id, id, display_name, description, is_public, users (id, name, email))') .eq('is_pending', true); - if (pubCollErr) { - console.error('Error fetching collection request data from database:', pubCollErr.message); - return NextResponse.json({ error: pubCollErr.message }, { status: 500 }); + if (collErr) { + console.error('Error fetching collection request data from database:', collErr.message); + return NextResponse.json({ error: collErr.message }, { status: 500 }); } - // console.log('Collections Request:', pubCollectionsReq); + // console.log('Collections Request:', collectionsReq); - return NextResponse.json({ pubCollectionsReq: pubCollectionsReq }); + return NextResponse.json({ collectionsReq: collectionsReq }); } diff --git a/frontend/app/components/admin-section.tsx b/frontend/app/components/admin-section.tsx index bbb8f79..9572916 100644 --- a/frontend/app/components/admin-section.tsx +++ b/frontend/app/components/admin-section.tsx @@ -2,7 +2,7 @@ "use client"; import { useState } from "react"; -import { AdminMenu, AdminCollectionsRequests, AdminManageCollections, AdminManageUsers } from "@/app/components/ui/admin"; +import { AdminMenu, AdminManageRequests, AdminManageCollections, AdminManageUsers } from "@/app/components/ui/admin"; import { ToastContainer } from "react-toastify"; import "react-toastify/dist/ReactToastify.css"; @@ -26,17 +26,17 @@ const AdminSection: React.FC = () => { setShowCollections={setShowCollections} /> - {/* New Requests Section */} + {/* Manage Requests Section */} {showNewRequest ? ( - + ) : null} - {/* Public Collections Section */} + {/* Manage Collections Section */} {showCollections ? ( ) : null} - {/* Users Section */} + {/* Manage Users Section */} {showUsers ? ( ) : null} diff --git a/frontend/app/components/ui/admin/admin-collections-requests.tsx b/frontend/app/components/ui/admin/admin-manage-requests.tsx similarity index 98% rename from frontend/app/components/ui/admin/admin-collections-requests.tsx rename to frontend/app/components/ui/admin/admin-manage-requests.tsx index e9fdd29..a73799a 100644 --- a/frontend/app/components/ui/admin/admin-collections-requests.tsx +++ b/frontend/app/components/ui/admin/admin-manage-requests.tsx @@ -6,7 +6,7 @@ import { IconSpinner } from '@/app/components/ui/icons'; import { toast } from 'react-toastify'; import Swal from 'sweetalert2'; -export default function AdminCollectionsRequests() { +export default function AdminManageRequests() { const [userRequests, setUserRequests] = useState([]); const [loading, setLoading] = useState(true); const [isRefreshed, setIsRefreshed] = useState(true); // Track whether the data has been refreshed @@ -34,8 +34,8 @@ export default function AdminCollectionsRequests() { return false; } const data = await response.json(); - setUserRequests(data.pubCollectionsReq); - console.log('Collection Requests:', data.pubCollectionsReq); + setUserRequests(data.collectionsReq); + console.log('Collection Requests:', data.collectionsReq); } catch (error) { console.error('Error fetching userRequest requests:', error); toast.error('Error fetching userRequest requests:', { diff --git a/frontend/app/components/ui/admin/index.ts b/frontend/app/components/ui/admin/index.ts index 94f7fef..d253df4 100644 --- a/frontend/app/components/ui/admin/index.ts +++ b/frontend/app/components/ui/admin/index.ts @@ -1,11 +1,11 @@ import AdminMenu from './admin-menu'; import AdminManageUsers from './admin-manage-users'; -import AdminCollectionsRequests from './admin-collections-requests'; +import AdminManageRequests from './admin-manage-requests'; import AdminManageCollections from './admin-manage-collections'; export { AdminMenu, - AdminCollectionsRequests, + AdminManageRequests, AdminManageCollections, AdminManageUsers }; \ No newline at end of file