diff --git a/src/pages/DesignerDetail.tsx b/src/pages/DesignerDetail.tsx index a82caf14..ce746b29 100644 --- a/src/pages/DesignerDetail.tsx +++ b/src/pages/DesignerDetail.tsx @@ -19,6 +19,7 @@ import { submitCompanyUpdate } from '@/lib/companyHelpers'; import { VersionIndicator } from '@/components/versioning/VersionIndicator'; import { EntityHistoryTabs } from '@/components/history/EntityHistoryTabs'; import { trackPageView } from '@/lib/viewTracking'; +import { useAuthModal } from '@/hooks/useAuthModal'; export default function DesignerDetail() { const { slug } = useParams<{ slug: string }>(); @@ -31,6 +32,7 @@ export default function DesignerDetail() { const [statsLoading, setStatsLoading] = useState(true); const { user } = useAuth(); const { isModerator } = useUserRole(); + const { requireAuth } = useAuthModal(); useEffect(() => { if (slug) { @@ -161,13 +163,7 @@ export default function DesignerDetail() { diff --git a/src/pages/ParkOwners.tsx b/src/pages/ParkOwners.tsx index 06c7450c..57646e15 100644 --- a/src/pages/ParkOwners.tsx +++ b/src/pages/ParkOwners.tsx @@ -61,8 +61,6 @@ const ParkOwners = () => { const handleCreateSubmit = async (data: any) => { try { - if (!user) return; - await submitCompanyCreation( data, 'property_owner', diff --git a/src/pages/ParkRides.tsx b/src/pages/ParkRides.tsx index 6de72567..7f188cc5 100644 --- a/src/pages/ParkRides.tsx +++ b/src/pages/ParkRides.tsx @@ -115,13 +115,8 @@ export default function ParkRides() { const handleCreateSubmit = async (data: Omit & { park_id?: string }) => { try { - if (!user) { - navigate('/auth'); - return; - } - // Pre-fill park_id in the submission - const submissionData = { + const submissionData = { ...data, park_id: park.id, }; diff --git a/src/pages/Parks.tsx b/src/pages/Parks.tsx index 53bce7f8..922e16e5 100644 --- a/src/pages/Parks.tsx +++ b/src/pages/Parks.tsx @@ -238,8 +238,6 @@ export default function Parks() { }; const handleParkSubmit = async (parkData: any) => { - if (!user) return; - try { const { submitParkCreation } = await import('@/lib/entitySubmissionHelpers'); await submitParkCreation(parkData, user.id); diff --git a/src/pages/PropertyOwnerDetail.tsx b/src/pages/PropertyOwnerDetail.tsx index 35616ce7..c4c9a8bb 100644 --- a/src/pages/PropertyOwnerDetail.tsx +++ b/src/pages/PropertyOwnerDetail.tsx @@ -20,6 +20,7 @@ import { toast } from '@/hooks/use-toast'; import { submitCompanyUpdate } from '@/lib/companyHelpers'; import { VersionIndicator } from '@/components/versioning/VersionIndicator'; import { EntityHistoryTabs } from '@/components/history/EntityHistoryTabs'; +import { useAuthModal } from '@/hooks/useAuthModal'; export default function PropertyOwnerDetail() { const { slug } = useParams<{ slug: string }>(); @@ -35,6 +36,7 @@ export default function PropertyOwnerDetail() { const [totalPhotos, setTotalPhotos] = useState(0); const { user } = useAuth(); const { isModerator } = useUserRole(); + const { requireAuth } = useAuthModal(); useEffect(() => { if (slug) { @@ -206,13 +208,7 @@ export default function PropertyOwnerDetail() {