fix(web): add feature flag gate to webhooks page for consistency with inbox/planner
This commit is contained in:
parent
38a15c0595
commit
a9361b44bb
@ -12,6 +12,7 @@ import {
|
||||
type WebhookSubscription,
|
||||
type EventType,
|
||||
} from '@/lib/webhook-client';
|
||||
import { isEnabled } from '@/lib/feature-flags';
|
||||
|
||||
export default function WebhooksPage() {
|
||||
const [subs, setSubs] = useState<WebhookSubscription[]>([]);
|
||||
@ -23,6 +24,8 @@ export default function WebhooksPage() {
|
||||
const [newDesc, setNewDesc] = useState('');
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
const enabled = isEnabled('webhooks.enabled');
|
||||
|
||||
const loadData = useCallback(async () => {
|
||||
setLoading(true);
|
||||
try {
|
||||
@ -35,7 +38,7 @@ export default function WebhooksPage() {
|
||||
setLoading(false);
|
||||
}, []);
|
||||
|
||||
useEffect(() => { loadData(); }, [loadData]);
|
||||
useEffect(() => { if (enabled) loadData(); }, [enabled, loadData]);
|
||||
|
||||
const handleCreate = async () => {
|
||||
if (!newUrl.trim() || newEvents.length === 0) {
|
||||
@ -76,6 +79,17 @@ export default function WebhooksPage() {
|
||||
setNewEvents(prev => prev.includes(type) ? prev.filter(t => t !== type) : [...prev, type]);
|
||||
};
|
||||
|
||||
if (!enabled) {
|
||||
return (
|
||||
<div className="min-h-screen flex items-center justify-center" style={{ backgroundColor: 'var(--cm-bg-canvas)' }}>
|
||||
<div className="text-center">
|
||||
<Globe size={48} style={{ color: 'var(--cm-text-tertiary)' }} className="mx-auto mb-4" />
|
||||
<p className="text-sm" style={{ color: 'var(--cm-text-secondary)' }}>Webhooks are not enabled. Enable the <code>webhooks.enabled</code> flag.</p>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="min-h-screen" style={{ backgroundColor: 'var(--cm-bg-canvas)' }}>
|
||||
<div className="max-w-2xl mx-auto px-4 py-6">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user