How to avoid login if already logged in in angular js
<p>In my application i am maintaining URLs to separate the customers like </p>

<p>myapp.localhost.com/#/customer1
myapp.localhost.com/#/customer2</p>

<p>Now say customer1 logged in. Then in same browser but in other tab customer2 is entering his url. At this point i want to avoid customer2 to login and when he hit url i want to give customer1 url again as logged in.</p>

<p>I have used below code.</p>

<pre><code>    .factory('authService', function ($rootScope, $state, $auth, $location,     $stateParams) {
    return {
        isLoggedin: function () {
            console.log($auth.isAuthenticated());
            if (!$auth.isAuthenticated()) {
                if($rootScope.currentUser.accessLevel == '1')
                {
                    $rootScope.currentUser = null;
                    $location.path('/admin');
                }
                else
                {
                    $rootScope.currentUser = null;
                    //$state.go('customer',{'customerTag' : localStorage.getItem('customerTag')});
                    $location.path("/"+localStorage.getItem('customerTag'));
                }
                return true;
            }
        }
    };
})


 .run(function($rootScope, $state, $stateParams, $location, $auth) {
    $rootScope.$state = $state;
    $rootScope.$on('$stateChangeStart', function(event, toState) {
    });
    });
</code></pre>

<p>Please suggest the solution</p>