                 promise = $rs.projects.leave($scope.project.id)
 
                 promise.then =>
-                    response.finish()
-                    $confirm.notify("success")
-                    $location.path($navurls.resolve("home"))
+                    currentUserService.loadProjects().then () ->
+                        response.finish()
+                        $confirm.notify("success")
+                        $location.path($navurls.resolve("home"))
 
                 promise.then null, (response) ->
                     response.finish()

## Leave project Directive
#############################################################################

LeaveProjectDirective = ($repo, $confirm, $location, $rs, $navurls, $translate, lightboxFactory) ->
    link = ($scope, $el, $attrs) ->
        leaveConfirm = () ->
            leave_project_text = $translate.instant("TEAM.ACTION_LEAVE_PROJECT")

        link: link
    }

module.directive("tgLeaveProject", ["$tgRepo", "$tgConfirm", "$tgLocation", "$tgResources", "$tgNavUrls", "$translate", "tgLightboxFactory", "tgCurrentUserService",
                                    LeaveProjectDirective])


