Skip to content

Commit c18fe8e

Browse files
committed
fix(admin): create missing shipping-config endpoint and suppress Radix UI warnings
1 parent ff47ece commit c18fe8e

File tree

3 files changed

+50
-2
lines changed

3 files changed

+50
-2
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import { NextRequest, NextResponse } from 'next/server';
2+
import { createClient } from '@/lib/supabase/server';
3+
4+
export async function POST(req: NextRequest) {
5+
try {
6+
const supabase = await createClient();
7+
8+
// Ensure user is authenticated
9+
const { data: { user } } = await supabase.auth.getUser();
10+
if (!user) {
11+
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
12+
}
13+
14+
// Check if user is an admin
15+
const { data: profile } = await supabase
16+
.from('profiles')
17+
.select('role')
18+
.eq('id', user.id)
19+
.single();
20+
21+
if (profile?.role !== 'admin') {
22+
return NextResponse.json({ error: 'Forbidden' }, { status: 403 });
23+
}
24+
25+
// Parse and save the shipping configuration
26+
const config = await req.json();
27+
28+
const { error } = await supabase
29+
.from('site_settings')
30+
.upsert(
31+
{
32+
setting_key: 'shipping_settings',
33+
setting_value: config
34+
},
35+
{ onConflict: 'setting_key' }
36+
);
37+
38+
if (error) {
39+
console.error('[Shipping Config] DB Error:', error);
40+
return NextResponse.json({ error: 'Failed to update shipping configuration' }, { status: 500 });
41+
}
42+
43+
return NextResponse.json({ success: true, message: 'Shipping configuration saved' });
44+
} catch (err: any) {
45+
console.error('[Shipping Config] Unexpected Error:', err);
46+
return NextResponse.json({ error: err.message }, { status: 500 });
47+
}
48+
}

components/admin/FulfillmentRitual.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ export function FulfillmentRitual({ order, isOpen, onOpenChange, onSuccess }: Fu
156156
else onOpenChange(open)
157157
}
158158
}}>
159-
<DialogContent className="bg-obsidian border-luxury-border text-white sm:max-w-[700px] p-0 overflow-hidden">
159+
<DialogContent aria-describedby={undefined} className="bg-obsidian border-luxury-border text-white sm:max-w-[700px] p-0 overflow-hidden">
160160
<div className="h-1.5 bg-gold/20 w-full">
161161
<div
162162
className="h-full bg-gold transition-all duration-700 ease-in-out"

components/admin/MediaPicker.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ export function MediaPicker({ onSelect, trigger, multiSelect = false, onSelectMu
111111
</Button>
112112
)}
113113
</DialogTrigger>
114-
<DialogContent className="max-w-4xl max-h-[85vh] overflow-hidden flex flex-col p-0 gap-0 border-luxury-border bg-[#0B0B0D] rounded-luxury shadow-luxury">
114+
<DialogContent aria-describedby={undefined} className="max-w-4xl max-h-[85vh] overflow-hidden flex flex-col p-0 gap-0 border-luxury-border bg-[#0B0B0D] rounded-luxury shadow-luxury">
115115
<DialogHeader className="p-6 border-b border-white/5 bg-[#0B0B0D]/5">
116116
<div className="flex items-center justify-between">
117117
<DialogTitle className="text-xl font-heading tracking-luxury text-white flex items-center gap-3">

0 commit comments

Comments
 (0)