requestAuthToken was set to async but he wasn't waited for his usage.
This commit is contained in:
Amaury 2021-07-27 18:33:53 +02:00
parent f579afab16
commit ae195d9170

View File

@ -27,7 +27,7 @@ class PeerTubeRequester {
this.password = config.password;
}
private async requestAuthToken(): Promise<void> {
private async requestAuthToken(): Promise<any> {
let response = await fetch(
new URL(`/api/v1/oauth-clients/local`, this.domain_name)
);
@ -60,7 +60,7 @@ class PeerTubeRequester {
}
async uploadFromUrl(message: UploadInstruction): Promise<void> {
const accessToken = this.requestAuthToken();
const accessToken = await this.requestAuthToken();
const myUploadForm = new URLSearchParams();
const myHeader = new Headers();
myHeader.append("Authorization", `Bearer ${accessToken}`);