mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 01:31:13 -05:00
Refactor: Unify moderation queue for all entities
This commit is contained in:
@@ -83,39 +83,24 @@ export default function Rides() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isModerator()) {
|
||||
const { error } = await supabase
|
||||
.from('rides')
|
||||
.insert(data);
|
||||
|
||||
if (error) throw error;
|
||||
|
||||
toast({
|
||||
title: "Ride Created",
|
||||
description: "The ride has been created successfully.",
|
||||
// All users submit for moderation
|
||||
const { error } = await supabase
|
||||
.from('content_submissions')
|
||||
.insert({
|
||||
user_id: user.id,
|
||||
submission_type: 'ride',
|
||||
status: 'pending',
|
||||
content: data
|
||||
});
|
||||
|
||||
setIsCreateModalOpen(false);
|
||||
fetchRides();
|
||||
} else {
|
||||
const { error } = await supabase
|
||||
.from('content_submissions')
|
||||
.insert({
|
||||
user_id: user.id,
|
||||
submission_type: 'ride',
|
||||
status: 'pending',
|
||||
content: data
|
||||
});
|
||||
if (error) throw error;
|
||||
|
||||
if (error) throw error;
|
||||
toast({
|
||||
title: "Ride Submitted",
|
||||
description: "Your ride submission has been sent for moderation review.",
|
||||
});
|
||||
|
||||
toast({
|
||||
title: "Submission Sent",
|
||||
description: "Your ride submission has been sent for moderation review.",
|
||||
});
|
||||
|
||||
setIsCreateModalOpen(false);
|
||||
}
|
||||
setIsCreateModalOpen(false);
|
||||
} catch (error: any) {
|
||||
toast({
|
||||
title: "Submission Failed",
|
||||
|
||||
Reference in New Issue
Block a user