mirror of
https://code.lenaisten.de/Lenaisten/advent22.git
synced 2024-11-23 00:03:07 +00:00
missing catch in api_get_blob
This commit is contained in:
parent
da09db3bda
commit
47eb42f0f5
1 changed files with 13 additions and 11 deletions
|
@ -127,17 +127,19 @@ export class Advent22 {
|
||||||
|
|
||||||
public api_get_blob(endpoint: string): Promise<string> {
|
public api_get_blob(endpoint: string): Promise<string> {
|
||||||
return new Promise<string>((resolve, reject) => {
|
return new Promise<string>((resolve, reject) => {
|
||||||
this._api_get<Blob>(endpoint, "blob").then((data: Blob) => {
|
this._api_get<Blob>(endpoint, "blob")
|
||||||
const reader = new FileReader();
|
.then((data: Blob) => {
|
||||||
reader.readAsDataURL(data);
|
const reader = new FileReader();
|
||||||
reader.onloadend = () => {
|
reader.readAsDataURL(data);
|
||||||
if (typeof reader.result === "string") {
|
reader.onloadend = () => {
|
||||||
resolve(reader.result);
|
if (typeof reader.result === "string") {
|
||||||
} else {
|
resolve(reader.result);
|
||||||
reject(["failed data url", endpoint]);
|
} else {
|
||||||
}
|
reject(["failed data url", endpoint]);
|
||||||
};
|
}
|
||||||
});
|
};
|
||||||
|
})
|
||||||
|
.catch(reject);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue