[CORD-1001] Solved race condition in autogeneration of models and tweaks for slow connections

Change-Id: Ifcbc4f9057f04e19703af96f8d8294f2b975be66
diff --git a/src/interceptors.ts b/src/interceptors.ts
index 0a2bf74..a79765e 100644
--- a/src/interceptors.ts
+++ b/src/interceptors.ts
@@ -8,12 +8,16 @@
 
 export function userStatusInterceptor($state: angular.ui.IStateService, $cookies: ng.cookies.ICookiesService, $q: ng.IQService) {
   const checkLogin = (res) => {
-    if (res.status === 401 || res.status === -1) {
-      $cookies.remove('sessionid', {path: '/'});
-      $state.go('login');
-      return $q.reject(res);
+    switch (res.status) {
+      case -1:
+      case 401:
+      case 500:
+        $cookies.remove('sessionid', {path: '/'});
+        $state.go('login');
+        return $q.reject(res);
+      default:
+        return res;
     }
-    return res;
   };
 
   return {