Skip to content

Commit

Permalink
Fix profile redirection
Browse files Browse the repository at this point in the history
  • Loading branch information
Daramola98 committed Jun 27, 2018
1 parent f257421 commit 56c7752
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions public/js/controllers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@ angular.module('mean.system').controller('IndexController', [
$scope.avatars = data;
});

if (localStorage.token) {
if ($location.url() === '/profile') {
$window.onload = $http.get(`/api/profile/${userId}`)
.then((res) => {
$scope.user = res.data;
});
} else if ($location.path === '/profile') {
}
if ($location.url() === '/profile' && !localStorage.token) {
$location.path('/');
}

Expand Down Expand Up @@ -156,6 +157,7 @@ angular.module('mean.system').controller('IndexController', [
}).then(
(response) => {
toastr.success('Friend Invitation accepted successfully');
$window.location.reload();
},
(error) => {
toastr.error('Error: Could not add friend');
Expand Down

0 comments on commit 56c7752

Please sign in to comment.