Skip to content

Commit 04c432c

Browse files
AmPlacecodex
andauthored
fix(offline): show native tools for destination storage (#631)
- Request offline download tools with the current save path. - Refresh the list when opening the dialog so native 115 and Thunder tools are visible. Co-authored-by: Codex <267193182+codex@users.noreply.github.com>
1 parent 3bf32ea commit 04c432c

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

src/pages/home/toolbar/OfflineDownloadEnhanced.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,9 @@ export const OfflineDownloadEnhanced = () => {
101101

102102
// 下载工具列表
103103
const [tools, setTools] = createSignal([] as string[])
104-
const [toolsLoading, reqTool] = useFetch((): PResp<string[]> => {
105-
return r.get("/public/offline_download_tools")
104+
const [toolsLoading, reqTool] = useFetch((path: string): PResp<string[]> => {
105+
const query = path ? `?path=${encodeURIComponent(path)}` : ""
106+
return r.get(`/public/offline_download_tools${query}`)
106107
})
107108
const [tool, setTool] = createSignal("")
108109
const [deletePolicy, setDeletePolicy] = createSignal<DeletePolicy>(
@@ -241,19 +242,22 @@ export const OfflineDownloadEnhanced = () => {
241242
}
242243
})
243244

244-
onMount(async () => {
245-
const resp = await reqTool()
245+
const loadTools = async (path: string) => {
246+
const resp = await reqTool(path)
246247
handleResp(resp, (data) => {
247248
setTools(data)
248249
setTool(data[0])
249250
})
250-
})
251+
}
252+
253+
onMount(() => loadTools(pathname()))
251254

252255
// 监听 bus 事件
253256
const handler = (name: string) => {
254257
if (name === "offline_download") {
255258
const currentPath = pathname()
256259
setSavePath(currentPath)
260+
void loadTools(currentPath)
257261
onOpen()
258262
}
259263
}

0 commit comments

Comments
 (0)