115 download button (#119)

* code refactoring, added file download

* code refactoring
This commit is contained in:
Marco
2023-12-27 15:38:02 +01:00
committed by GitHub
parent 3859c80214
commit f3302c17cc
2 changed files with 9 additions and 7 deletions

View File

@@ -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,
headers: {
...opt?.headers,
'X-Authentication': jwt ?? ''
}
const res = await fetch(url, opt)
})
if (!res.ok) {
throw await res.text()

View File

@@ -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>