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(
*
* This revokes and then forgets any OAuth credentials that the user has.
*/
function logout() {
return Promise.all([tokenInfoPromise, oauthClient()])
.then(([token, client]) => {
return client.revokeToken(token.accessToken);
})
.then(() => {
async function logout() {
const [token, client] = await Promise.all([
tokenInfoPromise,
oauthClient(),
]);
await client.revokeToken(token.accessToken);
tokenInfoPromise = Promise.resolve(null);
localStorage.removeItem(storageKey());
});
}
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