Commit a02f8bbb authored by Robert Knight's avatar Robert Knight

Convert a function from Promises to async/await

This is a small readability improvement, but mostly a canary to test
that the async-await support added in the previous commit is working.
parent 10b4b98f
...@@ -281,15 +281,14 @@ function auth( ...@@ -281,15 +281,14 @@ function auth(
* *
* This revokes and then forgets any OAuth credentials that the user has. * This revokes and then forgets any OAuth credentials that the user has.
*/ */
function logout() { async function logout() {
return Promise.all([tokenInfoPromise, oauthClient()]) const [token, client] = await Promise.all([
.then(([token, client]) => { tokenInfoPromise,
return client.revokeToken(token.accessToken); oauthClient(),
}) ]);
.then(() => { await client.revokeToken(token.accessToken);
tokenInfoPromise = Promise.resolve(null); tokenInfoPromise = Promise.resolve(null);
localStorage.removeItem(storageKey()); localStorage.removeItem(storageKey());
});
} }
listenForTokenStorageEvents(); listenForTokenStorageEvents();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment