115 download button (#119)
* code refactoring, added file download * code refactoring
This commit is contained in:
@@ -15,11 +15,13 @@ const fetcher = async <T>(url: string, opt?: RequestInit) => {
|
||||
}
|
||||
}
|
||||
|
||||
if (opt?.headers) {
|
||||
opt.headers = { ...opt.headers, 'X-Authentication': jwt ?? '' }
|
||||
}
|
||||
|
||||
const res = await fetch(url, opt)
|
||||
const res = await fetch(url, {
|
||||
...opt,
|
||||
headers: {
|
||||
...opt?.headers,
|
||||
'X-Authentication': jwt ?? ''
|
||||
}
|
||||
})
|
||||
|
||||
if (!res.ok) {
|
||||
throw await res.text()
|
||||
|
||||
@@ -122,7 +122,7 @@ export default function Downloaded() {
|
||||
combineLatestWith(selected$),
|
||||
map(([data, selected]) => data.map(x => ({
|
||||
...x,
|
||||
selected: selected.includes(x.path)
|
||||
selected: selected.includes(x.name)
|
||||
}))),
|
||||
share()
|
||||
), [])
|
||||
@@ -212,7 +212,7 @@ export default function Downloaded() {
|
||||
<Checkbox
|
||||
edge="end"
|
||||
checked={file.selected}
|
||||
onChange={() => addSelected(file.path)}
|
||||
onChange={() => addSelected(file.name)}
|
||||
/>
|
||||
</>}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user