Skip to content

Instantly share code, notes, and snippets.

@khades
Created June 13, 2016 07:58
Show Gist options
  • Save khades/bc16781862a7d0c00e8c3fe6deebcccc to your computer and use it in GitHub Desktop.
Save khades/bc16781862a7d0c00e8c3fe6deebcccc to your computer and use it in GitHub Desktop.
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