refactor: Use a unique wizard ID for file uploads during tenant creation, replacing the slug-based identification.
This commit is contained in:
parent
5b03dec1d8
commit
e17af04b46
@ -186,6 +186,8 @@ const CreateTenantWizard = (): ReactElement => {
|
|||||||
const [isUploadingFavicon, setIsUploadingFavicon] = useState<boolean>(false);
|
const [isUploadingFavicon, setIsUploadingFavicon] = useState<boolean>(false);
|
||||||
const [logoError, setLogoError] = useState<string | null>(null);
|
const [logoError, setLogoError] = useState<string | null>(null);
|
||||||
const [faviconError, setFaviconError] = useState<string | null>(null);
|
const [faviconError, setFaviconError] = useState<string | null>(null);
|
||||||
|
const [wizardId] = useState(() => crypto.randomUUID());
|
||||||
|
|
||||||
|
|
||||||
// Auto-generate slug and domain from name
|
// Auto-generate slug and domain from name
|
||||||
const nameValue = tenantDetailsForm.watch('name');
|
const nameValue = tenantDetailsForm.watch('name');
|
||||||
@ -940,9 +942,9 @@ const CreateTenantWizard = (): ReactElement => {
|
|||||||
setLogoPreviewUrl(previewUrl);
|
setLogoPreviewUrl(previewUrl);
|
||||||
setIsUploadingLogo(true);
|
setIsUploadingLogo(true);
|
||||||
try {
|
try {
|
||||||
const slug = tenantDetailsForm.getValues('slug');
|
const response = await fileService.upload(file, 'tenant', wizardId);
|
||||||
const response = await fileService.upload(file, slug || 'tenant');
|
|
||||||
const fileId = response.data.id;
|
const fileId = response.data.id;
|
||||||
|
|
||||||
setLogoFileAttachmentUuid(fileId);
|
setLogoFileAttachmentUuid(fileId);
|
||||||
|
|
||||||
const baseUrl = getBaseUrlWithProtocol();
|
const baseUrl = getBaseUrlWithProtocol();
|
||||||
@ -1050,9 +1052,9 @@ const CreateTenantWizard = (): ReactElement => {
|
|||||||
setFaviconPreviewUrl(previewUrl);
|
setFaviconPreviewUrl(previewUrl);
|
||||||
setIsUploadingFavicon(true);
|
setIsUploadingFavicon(true);
|
||||||
try {
|
try {
|
||||||
const slug = tenantDetailsForm.getValues('slug');
|
const response = await fileService.upload(file, 'tenant', wizardId);
|
||||||
const response = await fileService.upload(file, slug || 'tenant');
|
|
||||||
const fileId = response.data.id;
|
const fileId = response.data.id;
|
||||||
|
|
||||||
setFaviconFileAttachmentUuid(fileId);
|
setFaviconFileAttachmentUuid(fileId);
|
||||||
|
|
||||||
const baseUrl = getBaseUrlWithProtocol();
|
const baseUrl = getBaseUrlWithProtocol();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user