mirror of
https://gitlab.com/timvisee/send.git
synced 2025-12-06 22:20:55 +03:00
fixed getFileList when the response isn't OK
This commit is contained in:
@@ -359,7 +359,10 @@ export function downloadFile(id, keychain, onprogress) {
|
||||
export async function getFileList(bearerToken) {
|
||||
const headers = new Headers({ Authorization: `Bearer ${bearerToken}` });
|
||||
const response = await fetch('/api/filelist', { headers });
|
||||
return response.body; // stream
|
||||
if (response.ok) {
|
||||
return response.body; // stream
|
||||
}
|
||||
throw new Error(response.status);
|
||||
}
|
||||
|
||||
export async function setFileList(bearerToken, data) {
|
||||
@@ -369,5 +372,5 @@ export async function setFileList(bearerToken, data) {
|
||||
method: 'POST',
|
||||
body: data
|
||||
});
|
||||
return response.status === 200;
|
||||
return response.ok;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user