From 789e597271020e62ee25bf7f37964d51b4a3d00d Mon Sep 17 00:00:00 2001 From: tophf Date: Thu, 12 Aug 2021 16:55:04 +0300 Subject: [PATCH] use fetch directly --- popup/search.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/popup/search.js b/popup/search.js index ff87748c..7c424ff2 100644 --- a/popup/search.js +++ b/popup/search.js @@ -86,12 +86,11 @@ Events.openURLandHide.call(this, event); }, async prefetchAuthorId() { - return this._fetch || (this._fetch = new Promise(async resolve => { - const url = `${URLS.usoArchiveRaw[0]}styles/${this._id}.json`; - const json = await (await fetch(url)).json(); - this.href = makeUsoArchiveAuthorUrl(json.info.author.id); - resolve(); - })); + return this._fetch || ( + this._fetch = fetch(`${URLS.usoArchiveRaw[0]}styles/${this._id}.json`) + .then(r => r.json()) + .then(json => (this.href = makeUsoArchiveAuthorUrl(json.info.author.id))) + ); }, }, });