feat(阶段1): 搬入 ojnext 为 apps/web,未改业务代码

This commit is contained in:
xuyue committed 2026-08-06 21:18:16 -06:00
1 parent 3c975e85ee
commit ae1fb329b5
258 files changed
+40490 -91

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
import axios from "axios"
const http = axios.create({
baseURL: "/api/admin",
responseType: "blob",
xsrfHeaderName: "X-CSRFToken",
xsrfCookieName: "csrftoken",
})
async function download(url: string) {
const res = await http.get(url)
const headers = res.headers
const link = document.createElement("a")
link.href = window.URL.createObjectURL(
new window.Blob([res.data], { type: headers["content-type"] }),
)
link.download = (headers["content-disposition"] || "").split("filename=")[1]
document.body.appendChild(link)
link.click()
link.remove()
}
export default download