Initial commit: SmoothSchedule multi-tenant scheduling platform
This commit includes: - Django backend with multi-tenancy (django-tenants) - React + TypeScript frontend with Vite - Platform administration API with role-based access control - Authentication system with token-based auth - Quick login dev tools for testing different user roles - CORS and CSRF configuration for local development - Docker development environment setup 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
34
legacy_reference/frontend/src/hooks/useBusinessOAuth.ts
Normal file
34
legacy_reference/frontend/src/hooks/useBusinessOAuth.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* Business OAuth Settings Hooks
|
||||
*/
|
||||
|
||||
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
import { getBusinessOAuthSettings, updateBusinessOAuthSettings } from '../api/business';
|
||||
import { BusinessOAuthSettings, BusinessOAuthSettingsResponse } from '../types';
|
||||
|
||||
/**
|
||||
* Hook to get business OAuth settings and available providers
|
||||
*/
|
||||
export const useBusinessOAuthSettings = () => {
|
||||
return useQuery<BusinessOAuthSettingsResponse>({
|
||||
queryKey: ['businessOAuthSettings'],
|
||||
queryFn: getBusinessOAuthSettings,
|
||||
staleTime: 5 * 60 * 1000, // 5 minutes
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Hook to update business OAuth settings
|
||||
*/
|
||||
export const useUpdateBusinessOAuthSettings = () => {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation({
|
||||
mutationFn: (settings: Partial<BusinessOAuthSettings>) =>
|
||||
updateBusinessOAuthSettings(settings),
|
||||
onSuccess: (data) => {
|
||||
// Update the cached data
|
||||
queryClient.setQueryData(['businessOAuthSettings'], data);
|
||||
},
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user