From 4647580196d12d98a41e0746e8c1d26fc2d325df Mon Sep 17 00:00:00 2001 From: Jacob Embree Date: Fri, 12 Jan 2018 20:50:21 -0500 Subject: [PATCH] Make logout succeed regardless of how the server responds --- src/modules/user/user.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/modules/user/user.js b/src/modules/user/user.js index 86f5be60..dda93800 100644 --- a/src/modules/user/user.js +++ b/src/modules/user/user.js @@ -100,6 +100,15 @@ function user_logout_pageshow() { success: function(data) { drupalgap_remove_pages_from_dom(); drupalgap_goto(drupalgap.settings.front, { reloadPage:true }); + }, + error: function(data) { + // Even in case of error, reset the user just as user_logout() does in + // case of success. + Drupal.user = drupal_user_defaults(); + Drupal.sessid = null; + // Same as success above. + drupalgap_remove_pages_from_dom(); + drupalgap_goto(drupalgap.settings.front, { reloadPage:true }); } }); }