Skip to content

Commit

Permalink
Image id fixes for request
Browse files Browse the repository at this point in the history
  • Loading branch information
Gunka Artur committed Aug 9, 2024
1 parent 175b927 commit 69f5543
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions public/editor-client/src/media/addMedia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const addMedia: AddMediaData = {

wpMediaFrame.on("select", () => {
const attachment = wpMediaFrame.state().get("selection").first();
const { url, filename } = attachment.toJSON();
const { url } = attachment.toJSON();
const extension = getExtension(url);
const allExtensions = [
...acceptedExtensions,
Expand All @@ -57,7 +57,7 @@ export const addMedia: AddMediaData = {

getImageUid(attachment.get("id"))
.then((r) => {
res({ uid: r.uid, fileName: filename });
res({ uid: r.uid, fileName: "" });
})
.catch((r: unknown) => {
rej(t("failed to get attachment uid"));
Expand Down
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

0 comments on commit 69f5543

Please sign in to comment.