refactor: Use a unique wizard ID for file uploads during tenant creation, replacing the slug-based identification.

This commit is contained in:
Yashwin 2026-03-09 18:24:04 +05:30
parent 5b03dec1d8
commit e17af04b46

View File

@ -186,6 +186,8 @@ const CreateTenantWizard = (): ReactElement => {
const [isUploadingFavicon, setIsUploadingFavicon] = useState<boolean>(false);
const [logoError, setLogoError] = useState<string | null>(null);
const [faviconError, setFaviconError] = useState<string | null>(null);
const [wizardId] = useState(() => crypto.randomUUID());
// Auto-generate slug and domain from name
const nameValue = tenantDetailsForm.watch('name');
@ -940,9 +942,9 @@ const CreateTenantWizard = (): ReactElement => {
setLogoPreviewUrl(previewUrl);
setIsUploadingLogo(true);
try {
const slug = tenantDetailsForm.getValues('slug');
const response = await fileService.upload(file, slug || 'tenant');
const response = await fileService.upload(file, 'tenant', wizardId);
const fileId = response.data.id;
setLogoFileAttachmentUuid(fileId);
const baseUrl = getBaseUrlWithProtocol();
@ -1050,9 +1052,9 @@ const CreateTenantWizard = (): ReactElement => {
setFaviconPreviewUrl(previewUrl);
setIsUploadingFavicon(true);
try {
const slug = tenantDetailsForm.getValues('slug');
const response = await fileService.upload(file, slug || 'tenant');
const response = await fileService.upload(file, 'tenant', wizardId);
const fileId = response.data.id;
setFaviconFileAttachmentUuid(fileId);
const baseUrl = getBaseUrlWithProtocol();