图片上传url检测

This commit is contained in:
禺狨 2023-06-09 13:54:46 +08:00
parent 12cc5edbf6
commit 6010ac39d8
2 changed files with 12 additions and 3 deletions

View File

@ -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(),

View File

@ -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;
}