{"size": 873, "ext": "js", "max_stars_repo_path": "web/assets/services/userService.js", "max_stars_repo_name": "taverngoal/Tavern-Blog", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "web/assets/services/userService.js", "max_issues_repo_name": "taverngoal/Tavern-Blog", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "web/assets/services/userService.js", "max_forks_repo_name": "taverngoal/Tavern-Blog", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 37.9565217391, "max_line_length": 94, "alphanum_fraction": 0.4788087056}
/**
 * Created by tavern on 14/12/16.
 */
define(["angular", "angular-resource"], function (angular) {
    return angular.module("Etrain.Service.User", ["ngResource"])
        .service("userService", ["$resource", "$rootScope", function ($resource, $rootScope) {
            var url = "api/users/:id";
            var $this = this;
            this.User = $resource(url, {id: "@id"}, {
                login: {method: "post", url: "api/users/login"},
                reg: {method: "post", url: "api/users/reg"},
                current: {method: "get", url: "api/users/current"},
                logout: {method: "post", url: "api/users/logout"}
            });
            this.Logout = function () {
                $this.User.logout(function () {
                    $rootScope.Config.User = {$resolved: true}
                });
            }
        }])

        ;
});