feat: Implement API and cache improvements

This commit is contained in:
gpt-engineer-app[bot]
2025-10-31 12:11:14 +00:00
parent 2fb983bb4f
commit 0d16bb511c
11 changed files with 584 additions and 9 deletions

View File

@@ -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.",