Skip to content

Instantly share code, notes, and snippets.

@ingydotnet
Created January 17, 2012 21:21
Show Gist options
  • Save ingydotnet/1628950 to your computer and use it in GitHub Desktop.
Save ingydotnet/1628950 to your computer and use it in GitHub Desktop.
diff --git a/console/web/js/console.js b/console/web/js/console.js
index c6aa589..1c07872 100644
--- a/console/web/js/console.js
+++ b/console/web/js/console.js
@@ -362,7 +362,7 @@ $Console.hook('action_events', null, function() {
// Create a new rest object, using the current auth token if present.
$Console.new_rest = function(conf) {
var rest = new Console.Rest(conf, this.state.token);
- rest.error = this.bind('error_display');
+ rest.error = this.bind('error_display', rest);
return rest;
};
@@ -410,9 +410,13 @@ $Console.api_error = function(rest, data) {
);
}
-$Console.error_display = function() {
- $('div.content').jemplate('view/error.html');
- this.msg("An unexpected error has occurred!");
+$Console.error_display = function(rest) {
+ if (rest.status() == 403)
+ this.redirect('/');
+ else {
+ $('div.content').jemplate('view/error.html');
+ this.msg("An unexpected error has occurred!");
+ }
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment