mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 18:31:13 -05:00
31 lines
811 B
TypeScript
31 lines
811 B
TypeScript
import { useQuery } from '@tanstack/react-query';
|
|
import { supabase } from '@/lib/supabaseClient';
|
|
|
|
/**
|
|
* Hook to fetch public Novu settings accessible to all authenticated users
|
|
*/
|
|
export function usePublicNovuSettings() {
|
|
const { data: settings, isLoading, error } = useQuery({
|
|
queryKey: ['public-novu-settings'],
|
|
queryFn: async () => {
|
|
const { data, error } = await supabase
|
|
.from('admin_settings')
|
|
.select('setting_key, setting_value')
|
|
.eq('setting_key', 'novu.application_identifier')
|
|
.maybeSingle();
|
|
|
|
if (error) throw error;
|
|
return data;
|
|
},
|
|
});
|
|
|
|
const applicationIdentifier = settings?.setting_value as string || '';
|
|
|
|
return {
|
|
applicationIdentifier,
|
|
isLoading,
|
|
error,
|
|
isEnabled: !!applicationIdentifier,
|
|
};
|
|
}
|