Web: Client: the format parameter is added by condition

This commit is contained in:
Elyor Djalilov 2024-03-29 15:49:22 +05:00
parent 01e7eefb52
commit f7fd3bc30d
3 changed files with 11 additions and 4 deletions

View File

@ -113,8 +113,14 @@ const ConvertDialogComponent = (props) => {
fileId: convertItem.id,
toFolderId: folderId,
action: "convert",
format: selectedOptionType, // need backend
};
if (isXML) {
item.format = selectedOptionType;
} else {
item.format = null;
}
item.fileInfo = convertItem;
convertFile(item, t, convertItem.isOpen);
} else {

View File

@ -447,7 +447,7 @@ class UploadDataStore {
while (index < len) {
const conversionItem = filesToConversion[index];
const { fileId, toFolderId, password } = conversionItem;
const { fileId, toFolderId, password, format } = conversionItem;
const itemPassword = password ? password : null;
const file = this.files.find((f) => f.fileId === fileId);
if (file) runInAction(() => (file.inConversion = true));
@ -459,7 +459,7 @@ class UploadDataStore {
const numberFiles = this.files.filter((f) => f.needConvert).length;
const res = convertFile(fileId, itemPassword)
const res = convertFile(fileId, format, itemPassword)
.then((res) => res)
.catch(() => {
const error = t("FailedToConvert");

View File

@ -764,10 +764,11 @@ export async function getNewFiles(folderId: number) {
// TODO: update res type
export async function convertFile(
fileId: string | number | null,
format = null,
password = null,
sync = false,
) {
const data = { password, sync };
const data = { password, sync, format };
const res = (await request({
method: "put",