Unverified Commit 31ade893 authored by Robert Knight's avatar Robert Knight Committed by GitHub

Merge pull request #1008 from hypothesis/enable-async-await

Enable async-await support
parents d30f27ad a02f8bbb
...@@ -9,6 +9,9 @@ ...@@ -9,6 +9,9 @@
} }
}] }]
], ],
"plugins": ["angularjs-annotate"], "plugins": [
"angularjs-annotate",
"transform-async-to-promises"
],
"ignore": ["**/vendor/*"] "ignore": ["**/vendor/*"]
} }
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
"aws-sdk": "^2.345.0", "aws-sdk": "^2.345.0",
"babel-plugin-angularjs-annotate": "^0.10.0", "babel-plugin-angularjs-annotate": "^0.10.0",
"babel-plugin-istanbul": "^5.1.0", "babel-plugin-istanbul": "^5.1.0",
"babel-plugin-transform-async-to-promises": "^0.8.6",
"babel-preset-env": "^1.7.0", "babel-preset-env": "^1.7.0",
"babelify": "^10.0.0", "babelify": "^10.0.0",
"browserify": "^16.2.3", "browserify": "^16.2.3",
......
...@@ -280,15 +280,14 @@ function auth( ...@@ -280,15 +280,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();
......
...@@ -1533,6 +1533,11 @@ babel-plugin-transform-async-to-generator@^6.22.0: ...@@ -1533,6 +1533,11 @@ babel-plugin-transform-async-to-generator@^6.22.0:
babel-plugin-syntax-async-functions "^6.8.0" babel-plugin-syntax-async-functions "^6.8.0"
babel-runtime "^6.22.0" babel-runtime "^6.22.0"
babel-plugin-transform-async-to-promises@^0.8.6:
version "0.8.6"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-async-to-promises/-/babel-plugin-transform-async-to-promises-0.8.6.tgz#da21f782ee9847ccd47e993de3914193b9d2b77c"
integrity sha512-bKgtoXHueZZQ+NjWaUj3juhtIU/7aqVUkhUnAWWBgnPVL4oAgKP0AOzz5kYvWzD+GB9ZIA6MKHhqWe0K3rSdqA==
babel-plugin-transform-es2015-arrow-functions@^6.22.0: babel-plugin-transform-es2015-arrow-functions@^6.22.0:
version "6.22.0" version "6.22.0"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-arrow-functions/-/babel-plugin-transform-es2015-arrow-functions-6.22.0.tgz#452692cb711d5f79dc7f85e440ce41b9f244d221" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-arrow-functions/-/babel-plugin-transform-es2015-arrow-functions-6.22.0.tgz#452692cb711d5f79dc7f85e440ce41b9f244d221"
......
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