diff --git a/src/compenents/upload-image-button/upload-image-sub/index.tsx b/src/compenents/upload-image-button/upload-image-sub/index.tsx index 91aa87a..db609ea 100644 --- a/src/compenents/upload-image-button/upload-image-sub/index.tsx +++ b/src/compenents/upload-image-button/upload-image-sub/index.tsx @@ -2,7 +2,7 @@ import { Button, message, Modal } from "antd"; import Dragger from "antd/es/upload/Dragger"; import { useState } from "react"; import config from "../../../js/config"; -import { getToken } from "../../../utils"; +import { getToken, checkUrl } from "../../../utils"; import { InboxOutlined } from "@ant-design/icons"; interface PropsInterface { @@ -17,8 +17,8 @@ export const UploadImageSub = (props: PropsInterface) => { name: "file", multiple: true, action: - config.app_url + - "/backend/v1/upload/minio?category_ids=" + + checkUrl(config.app_url) + + "backend/v1/upload/minio?category_ids=" + props.categoryIds.join(","), headers: { authorization: "Bearer " + getToken(), diff --git a/src/utils/index.ts b/src/utils/index.ts index 816b890..05c0a0c 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -124,3 +124,12 @@ export function ValidataCredentials(value: any) { } } } + +export function checkUrl(value: any) { + let url = value; + let str = url.substr(url.length - 1, 1); + if (str !== "/") { + url = url + "/"; + } + return url; +}