Refactor theme hook and update tenant creation logic to improve clarity and consistency. Remove unused tenant_id from Users component and ensure proper variable naming in CreateTenantWizard.

This commit is contained in:
Yashwin 2026-01-29 17:42:07 +05:30
parent a4975e37b8
commit 621670ffbc
3 changed files with 4 additions and 5 deletions

View File

@ -8,7 +8,7 @@ import { fetchThemeAsync } from '@/store/themeSlice';
*/
export const useTenantTheme = (): void => {
const dispatch = useAppDispatch();
const { theme, faviconUrl, isInitialized, isLoading } = useAppSelector((state) => state.theme);
const { faviconUrl, isInitialized, isLoading } = useAppSelector((state) => state.theme);
useEffect(() => {
// Only fetch if not already initialized

View File

@ -204,7 +204,7 @@ const CreateTenantWizard = (): ReactElement => {
const host = baseUrlObj.host; // e.g., "localhost:5173"
const protocol = baseUrlObj.protocol; // e.g., "http:" or "https:"
const autoGeneratedDomain = `${protocol}//${slug}.${host}/tenant`;
tenantDetailsForm.setValue('domain', autoGeneratedDomain, { shouldValidate: false });
tenantDetailsForm.setValue('domain', autoGeneratedDomain, { shouldValidate: false });
} catch {
// Fallback if URL parsing fails
const autoGeneratedDomain = `${baseUrlWithProtocol.replace(/\/$/, '')}/${slug}/tenant`;
@ -323,8 +323,8 @@ const CreateTenantWizard = (): ReactElement => {
primary_color: primary_color || undefined,
secondary_color: secondary_color || undefined,
accent_color: accent_color || undefined,
logo_file_path: logoFileUrl || undefined,
favicon_file_path: faviconFileUrl || undefined,
logo_file_path: logoFilePath || undefined,
favicon_file_path: faviconFilePath || undefined,
},
},
};

View File

@ -119,7 +119,6 @@ const Users = (): ReactElement => {
last_name: string;
status: 'active' | 'suspended' | 'deleted';
auth_provider: 'local';
tenant_id: string;
role_id: string;
}): Promise<void> => {
try {