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) {
|
const res = await fetch(url, {
|
||||||
opt.headers = { ...opt.headers, 'X-Authentication': jwt ?? '' }
|
...opt,
|
||||||
|
headers: {
|
||||||
|
...opt?.headers,
|
||||||
|
'X-Authentication': jwt ?? ''
|
||||||
}
|
}
|
||||||
|
})
|
||||||
const res = await fetch(url, opt)
|
|
||||||
|
|
||||||
if (!res.ok) {
|
if (!res.ok) {
|
||||||
throw await res.text()
|
throw await res.text()
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ export default function Downloaded() {
|
|||||||
combineLatestWith(selected$),
|
combineLatestWith(selected$),
|
||||||
map(([data, selected]) => data.map(x => ({
|
map(([data, selected]) => data.map(x => ({
|
||||||
...x,
|
...x,
|
||||||
selected: selected.includes(x.path)
|
selected: selected.includes(x.name)
|
||||||
}))),
|
}))),
|
||||||
share()
|
share()
|
||||||
), [])
|
), [])
|
||||||
@@ -212,7 +212,7 @@ export default function Downloaded() {
|
|||||||
<Checkbox
|
<Checkbox
|
||||||
edge="end"
|
edge="end"
|
||||||
checked={file.selected}
|
checked={file.selected}
|
||||||
onChange={() => addSelected(file.path)}
|
onChange={() => addSelected(file.name)}
|
||||||
/>
|
/>
|
||||||
</>}
|
</>}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user