[fix] API's 404 breaks page and message layout.

This commit is contained in:
opi 2015-11-15 15:50:59 +01:00
parent 6de20e73c7
commit 22514d7c8a
3 changed files with 10 additions and 2 deletions

File diff suppressed because one or more lines are too long

View file

@ -146,6 +146,12 @@ var app = Sammy('#main', function (sam) {
if (xhr.status == 200) {
// Fail with 200, WTF
callback({});
} else if (xhr.status == 404) {
// API's 404 are not JSON, we can't use raw responseJSON
// and responseText is a complete HTML document.
c.flash('fail', y18n.t('uri_not_found', [uri]));
// Redirect to previous page.
c.redirect(store.get('path-1'));
} else if (xhr.status == 401) {
if (uri === '/login') {
c.flash('fail', y18n.t('wrong_password'));

View file

@ -63,6 +63,7 @@
"unknown_argument" : "Unknown argument : %s",
"api_not_responding" : "API is not responding (Error : %s)",
"error_retrieve_feed" : "Could not retrieve feed : %s",
"uri_not_found" : "Page not found : %s",
"confirm_delete" : "Are you sure you want to delete %s ?",
"confirm_change_maindomain" : "Are you sure you want to change the main domain ?",