Skip to content

Commit

Permalink
use direct
Browse files Browse the repository at this point in the history
  • Loading branch information
Gunka Artur committed Aug 9, 2024
1 parent 83480a0 commit 71d28c5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions public/editor-client/src/media/addMediaGallery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
SelectionData
} from "../types/Media";
import { t } from "../utils/i18n";
import { uploadImage } from "./utils";
import { getImageUid } from "@/api";

export const addMediaGallery: AddMediaGallery = {
label: "Image",
Expand Down Expand Up @@ -53,8 +53,8 @@ export const addMediaGallery: AddMediaGallery = {
);

Promise.all(
images.map((file: ImageUpload) => {
return uploadImage(file);
images.map(({ id }: ImageUpload) => {
return getImageUid(String(id)).then(({ uid }) => ({ uid, fileName: "" }));
})
)
.then((uploadedImages: AddImageData[]) => {
Expand Down
5 changes: 3 additions & 2 deletions public/editor-client/src/media/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import { getImageUid } from "../api";
import { AddImageData, ImageUpload } from "../types/Media";

export const uploadImage = ({
id
id,
fileName
}: ImageUpload): Promise<AddImageData> =>
getImageUid(String(id)).then(({ uid }) => ({ uid, fileName: "" }));
getImageUid(String(id)).then(({ uid }) => ({ uid, fileName }));

export const internalAcceptedExtensions = ["webp"];

0 comments on commit 71d28c5

Please sign in to comment.