mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-22 21:31:14 -05:00
Refactor code structure and remove redundant changes
This commit is contained in:
30
src-old/hooks/usePublicNovuSettings.ts
Normal file
30
src-old/hooks/usePublicNovuSettings.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
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,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user