Created
June 13, 2016 07:58
-
-
Save khades/bc16781862a7d0c00e8c3fe6deebcccc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var m = require("mithril") | |
var Auth = { | |
request: function(config) { | |
return m.request(config).then(function (data) { | |
return data | |
}, function (error) { | |
if (error.status == 401) { | |
localStorage.setItem("redirect", m.route.getPath()); | |
window.location = "/oauth/initiateAuth" | |
} | |
return error | |
}) | |
} | |
} | |
module.exports = Auth |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment