ducky/web

Paddy 2015-07-07 Parent:3bdc03963abe

18:9b97c908a706 Go to Latest

ducky/web/src/helpers/oauth-refresh.js

Fix bug in oauth-refresh, update for hosted path. Our nginx-fronted path has changed, so update the helper to hit the right URL. Also, fix a bug that would cause every failed request to be retried, which was suboptimal.

History
     1.1 --- a/src/helpers/oauth-refresh.js	Tue Jul 07 21:17:49 2015 -0400
     1.2 +++ b/src/helpers/oauth-refresh.js	Tue Jul 07 21:19:11 2015 -0400
     1.3 @@ -6,7 +6,7 @@
     1.4  
     1.5  const getRefresh = (opts, callback) => {
     1.6    const refreshOpts = {
     1.7 -    url: config.urlBase + '/token',
     1.8 +    url: config.urlBase + '/auth/token',
     1.9      method: 'POST',
    1.10      headers: {
    1.11        'Content-Type': 'application/x-www-form-urlencoded',
    1.12 @@ -95,7 +95,7 @@
    1.13  const refreshSync = (action, moc, opts) => {
    1.14    const oldError = opts.error
    1.15    opts.error = function(resp) {
    1.16 -    if(opts.noRefresh || !shouldRefreshSync) {
    1.17 +    if(opts.noRefresh || !shouldRefreshSync(resp)) {
    1.18        oldError(resp)
    1.19        return
    1.20      }