mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-21 13:31:13 -05:00
feat: Implement API and cache improvements
This commit is contained in:
@@ -4,6 +4,7 @@ import { useAuth } from './useAuth';
|
||||
import { useUserRole } from './useUserRole';
|
||||
import { useToast } from './use-toast';
|
||||
import { useCallback, useMemo } from 'react';
|
||||
import { queryKeys } from '@/lib/queryKeys';
|
||||
|
||||
interface AdminSetting {
|
||||
id: string;
|
||||
@@ -24,7 +25,7 @@ export function useAdminSettings() {
|
||||
isLoading,
|
||||
error
|
||||
} = useQuery({
|
||||
queryKey: ['admin-settings'],
|
||||
queryKey: queryKeys.admin.settings(),
|
||||
queryFn: async () => {
|
||||
const { data, error } = await supabase
|
||||
.from('admin_settings')
|
||||
@@ -59,7 +60,7 @@ export function useAdminSettings() {
|
||||
if (error) throw error;
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ['admin-settings'] });
|
||||
queryClient.invalidateQueries({ queryKey: queryKeys.admin.settings() });
|
||||
toast({
|
||||
title: "Setting Updated",
|
||||
description: "The setting has been saved successfully.",
|
||||
|
||||
Reference in New Issue
Block a user