mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-08-28 19:47:49 +08:00
fix(type): 修复Axios请求类型声明
This commit is contained in:
@@ -196,7 +196,7 @@ async function list_files() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 加载数据
|
// 加载数据
|
||||||
const data = ((await inProps.axios.request(config)) as any) ?? []
|
const data = ((await inProps.axios.request<FileItem[], FileItem[]>(config))) ?? []
|
||||||
// 如果当前路径已经变化,则放弃此次加载结果
|
// 如果当前路径已经变化,则放弃此次加载结果
|
||||||
if (prevURI !== takeURISnapshot()) {
|
if (prevURI !== takeURISnapshot()) {
|
||||||
return;
|
return;
|
||||||
@@ -300,7 +300,7 @@ async function download(item: FileItem) {
|
|||||||
responseType: 'blob',
|
responseType: 'blob',
|
||||||
}
|
}
|
||||||
// 加载数据
|
// 加载数据
|
||||||
const result: Blob = (await inProps.axios.request(config)) as any
|
const result: Blob = (await inProps.axios.request<Blob, Blob>(config))
|
||||||
if (result) {
|
if (result) {
|
||||||
const downloadUrl = URL.createObjectURL(result)
|
const downloadUrl = URL.createObjectURL(result)
|
||||||
window.open(downloadUrl, '_blank')
|
window.open(downloadUrl, '_blank')
|
||||||
@@ -318,7 +318,7 @@ async function getImgLink(item: FileItem) {
|
|||||||
responseType: 'blob',
|
responseType: 'blob',
|
||||||
}
|
}
|
||||||
// 加载二进制数据
|
// 加载二进制数据
|
||||||
const result: Blob = (await inProps.axios.request(config)) as any
|
const result: Blob = (await inProps.axios.request<Blob, Blob>(config))
|
||||||
if (result) {
|
if (result) {
|
||||||
// 创建图片地址
|
// 创建图片地址
|
||||||
currentImgLink.value = URL.createObjectURL(result)
|
currentImgLink.value = URL.createObjectURL(result)
|
||||||
@@ -395,7 +395,7 @@ async function rename() {
|
|||||||
method: inProps.endpoints?.rename.method || 'post',
|
method: inProps.endpoints?.rename.method || 'post',
|
||||||
data: currentItem.value,
|
data: currentItem.value,
|
||||||
}
|
}
|
||||||
const result: { [key: string]: any } = (await inProps.axios?.request(config)) as any
|
const result: { [key: string]: any } = (await inProps.axios?.request<any, { [key: string]: any }>(config))
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
$toast.error(result.message)
|
$toast.error(result.message)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ async function loadSubdirectories(path: string) {
|
|||||||
data: fakeItem,
|
data: fakeItem,
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = (await props.axios?.request(config)) as any
|
const result = (await props.axios?.request(config))
|
||||||
if (result && Array.isArray(result)) {
|
if (result && Array.isArray(result)) {
|
||||||
// 过滤出目录项
|
// 过滤出目录项
|
||||||
const dirs = result.filter(item => item.type === 'dir')
|
const dirs = result.filter(item => item.type === 'dir')
|
||||||
|
|||||||
Reference in New Issue
Block a user