[bug] Incorrect formatting of files in ProfileModal
This commit is contained in:
parent
1d0d0c034d
commit
334f548cbb
@ -2,6 +2,7 @@ import React, { useState, memo } from 'react';
|
|||||||
import Modal from './modal/Modal';
|
import Modal from './modal/Modal';
|
||||||
import './ProfileModal.css';
|
import './ProfileModal.css';
|
||||||
import type { ProfileData } from '../sdk/models/ProfileData';
|
import type { ProfileData } from '../sdk/models/ProfileData';
|
||||||
|
import type { FileBlob } from '../sdk/models/Data';
|
||||||
|
|
||||||
interface ProfileModalProps {
|
interface ProfileModalProps {
|
||||||
isOpen: boolean;
|
isOpen: boolean;
|
||||||
@ -34,10 +35,16 @@ function ProfileModal({ isOpen, onClose, onSubmit, initialData = {} }: ProfileMo
|
|||||||
if (type === 'file' && files) {
|
if (type === 'file' && files) {
|
||||||
// Assuming you want to handle a single file
|
// Assuming you want to handle a single file
|
||||||
const file = files[0];
|
const file = files[0];
|
||||||
setProfileData(prev => ({
|
file.arrayBuffer().then(arrayBuffer => {
|
||||||
...prev,
|
const fileBlob: FileBlob = {
|
||||||
[name]: file
|
type: file.type,
|
||||||
}));
|
data: new Uint8Array(arrayBuffer)
|
||||||
|
};
|
||||||
|
setProfileData(prev => ({
|
||||||
|
...prev,
|
||||||
|
[name]: fileBlob
|
||||||
|
}));
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
setProfileData(prev => ({
|
setProfileData(prev => ({
|
||||||
...prev,
|
...prev,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user