Add mod submission function
This commit is contained in:
parent
7c0fec574a
commit
a1c3e68b06
@ -42,6 +42,22 @@ export default function () {
|
|||||||
const toast = useToast();
|
const toast = useToast();
|
||||||
const [uploading, setUploading] = useState(false);
|
const [uploading, setUploading] = useState(false);
|
||||||
const [turnstileToken, setTurnstileToken] = useState("");
|
const [turnstileToken, setTurnstileToken] = useState("");
|
||||||
|
const fileTypes: { [k: string]: string } = {
|
||||||
|
gif: "image/gif",
|
||||||
|
heic: "image/heic",
|
||||||
|
heif: "image/heif",
|
||||||
|
jfif: "image/jpeg",
|
||||||
|
jpeg: "image/jpeg",
|
||||||
|
jpg: "image/jpg",
|
||||||
|
m4v: "video/x-m4v",
|
||||||
|
mkv: "video/x-matroska",
|
||||||
|
mov: "video/quicktime",
|
||||||
|
mp4: "video/mp4",
|
||||||
|
png: "image/png",
|
||||||
|
webp: "image/webp",
|
||||||
|
webm: "video/webm",
|
||||||
|
wmv: "video/x-ms-wmv",
|
||||||
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (sessionStorage.getItem("REPORT_SUCCESS")) {
|
if (sessionStorage.getItem("REPORT_SUCCESS")) {
|
||||||
@ -164,7 +180,9 @@ export default function () {
|
|||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
duplex: supportsRequestStreams ? "half" : undefined,
|
duplex: supportsRequestStreams ? "half" : undefined,
|
||||||
headers: {
|
headers: {
|
||||||
"content-type": file.type,
|
"content-type":
|
||||||
|
file.type ||
|
||||||
|
fileTypes[file.name.split(".")[file.name.split(".").length - 1]],
|
||||||
},
|
},
|
||||||
method: "PUT",
|
method: "PUT",
|
||||||
}).catch(console.error);
|
}).catch(console.error);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user