feat: Implement authentication integration

This commit is contained in:
gpt-engineer-app[bot]
2025-09-30 13:51:59 +00:00
parent 083a4af08c
commit f7ce456cc0
3 changed files with 30 additions and 4 deletions

View File

@@ -1,6 +1,7 @@
import { useState, useEffect } from 'react';
import { useToast } from '@/hooks/use-toast';
import { useUserRole } from '@/hooks/useUserRole';
import { useAuth } from '@/hooks/useAuth';
import {
fetchSubmissionItems,
buildDependencyTree,
@@ -48,6 +49,7 @@ export function SubmissionReviewManager({
const { toast } = useToast();
const { isAdmin, isSuperuser } = useUserRole();
const { user } = useAuth();
const isMobile = useIsMobile();
const Container = isMobile ? Sheet : Dialog;
@@ -116,10 +118,19 @@ export function SubmissionReviewManager({
};
const handleApprove = async () => {
if (!user?.id) {
toast({
title: 'Authentication Required',
description: 'You must be logged in to approve items',
variant: 'destructive',
});
return;
}
setLoading(true);
try {
const selectedItems = items.filter(item => selectedItemIds.has(item.id));
await approveSubmissionItems(selectedItems, 'current-user-id'); // TODO: Get from auth
await approveSubmissionItems(selectedItems, user.id);
toast({
title: 'Success',
@@ -162,9 +173,18 @@ export function SubmissionReviewManager({
};
const handleEscalate = async (reason: string) => {
if (!user?.id) {
toast({
title: 'Authentication Required',
description: 'You must be logged in to escalate submissions',
variant: 'destructive',
});
return;
}
setLoading(true);
try {
await escalateSubmission(submissionId, reason, 'current-user-id'); // TODO: Get from auth
await escalateSubmission(submissionId, reason, user.id);
toast({
title: 'Escalated',