Run js-beautify and fixjsstyle on code
Found this pointer on stackoverflow:
https://stackoverflow.com/a/31660434/5508494
End goal is to get the code formatted well enough that
clang format will run correctly against it.
Change-Id: I80053e78d253d8eee49233e42d55e5807ae8fdc8
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
diff --git a/app/common/services/userModel.js b/app/common/services/userModel.js
index e25d3f9..cd943f9 100644
--- a/app/common/services/userModel.js
+++ b/app/common/services/userModel.js
@@ -7,53 +7,59 @@
*/
-window.angular && (function (angular) {
- 'use strict';
+window.angular && (function(angular) {
+ 'use strict';
- angular
- .module('app.common.services')
- .service('userModel', ['APIUtils',function(APIUtils){
- return {
- login : function(username, password, callback){
- APIUtils.login(username, password, function(response, error){
- if(response &&
- (response.status == APIUtils.API_RESPONSE.SUCCESS_STATUS
- || response.status === undefined)){
- sessionStorage.setItem('LOGIN_ID', username);
- callback(true);
- }else if(response && response.data && response.data.data
- && response.data.data.description){
- callback(false, response.data.data.description);
- }else if(response && response.message){
- callback(false, response.message);
- }else if(error){
- callback(false, 'Server unreachable');
- }else{
- callback(false, 'Internal error');
- }
- });
- },
- isLoggedIn : function(){
- if(sessionStorage.getItem('LOGIN_ID') === null){
- return false;
- }
- return true;
- },
- logout : function(callback){
- APIUtils.logout(function(response, error){
- if(response &&
- response.status == APIUtils.API_RESPONSE.SUCCESS_STATUS){
- sessionStorage.removeItem('LOGIN_ID');
- sessionStorage.removeItem(APIUtils.HOST_SESSION_STORAGE_KEY);
- callback(true);
- }else if(response.status == APIUtils.API_RESPONSE.ERROR_STATUS){
- callback(false);
- }else{
- callback(false, error);
- }
- });
- }
- };
- }]);
+ angular
+ .module('app.common.services')
+ .service('userModel', ['APIUtils', function(APIUtils) {
+ return {
+ login: function(username, password, callback) {
+ APIUtils.login(username, password, function(response, error) {
+ if (response &&
+ (response.status == APIUtils.API_RESPONSE.SUCCESS_STATUS ||
+ response.status === undefined)) {
+ sessionStorage.setItem('LOGIN_ID', username);
+ callback(true);
+ }
+ else if (response && response.data && response.data.data &&
+ response.data.data.description) {
+ callback(false, response.data.data.description);
+ }
+ else if (response && response.message) {
+ callback(false, response.message);
+ }
+ else if (error) {
+ callback(false, 'Server unreachable');
+ }
+ else {
+ callback(false, 'Internal error');
+ }
+ });
+ },
+ isLoggedIn: function() {
+ if (sessionStorage.getItem('LOGIN_ID') === null) {
+ return false;
+ }
+ return true;
+ },
+ logout: function(callback) {
+ APIUtils.logout(function(response, error) {
+ if (response &&
+ response.status == APIUtils.API_RESPONSE.SUCCESS_STATUS) {
+ sessionStorage.removeItem('LOGIN_ID');
+ sessionStorage.removeItem(APIUtils.HOST_SESSION_STORAGE_KEY);
+ callback(true);
+ }
+ else if (response.status == APIUtils.API_RESPONSE.ERROR_STATUS) {
+ callback(false);
+ }
+ else {
+ callback(false, error);
+ }
+ });
+ }
+ };
+ }]);
})(window.angular);