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:
41
frontend/src/hooks/usePlatform.ts
Normal file
41
frontend/src/hooks/usePlatform.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* Platform Hooks
|
||||
* React Query hooks for platform-level operations
|
||||
*/
|
||||
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { getBusinesses, getUsers, getBusinessUsers } from '../api/platform';
|
||||
|
||||
/**
|
||||
* Hook to get all businesses (platform admin only)
|
||||
*/
|
||||
export const useBusinesses = () => {
|
||||
return useQuery({
|
||||
queryKey: ['platform', 'businesses'],
|
||||
queryFn: getBusinesses,
|
||||
staleTime: 5 * 60 * 1000, // 5 minutes
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Hook to get all users (platform admin only)
|
||||
*/
|
||||
export const usePlatformUsers = () => {
|
||||
return useQuery({
|
||||
queryKey: ['platform', 'users'],
|
||||
queryFn: getUsers,
|
||||
staleTime: 5 * 60 * 1000, // 5 minutes
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Hook to get users for a specific business
|
||||
*/
|
||||
export const useBusinessUsers = (businessId: number | null) => {
|
||||
return useQuery({
|
||||
queryKey: ['platform', 'business-users', businessId],
|
||||
queryFn: () => getBusinessUsers(businessId!),
|
||||
enabled: !!businessId,
|
||||
staleTime: 5 * 60 * 1000, // 5 minutes
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user