/**
 * Created by PC on 11/27/2016.
 */
angular.module('myApp')
    .service('UserService', function ($http, API_URL) {
        var url = [API_URL, 'user/'].join('');

        this.fetchUser = function () {
            return $http.get([url, 'fetch'].join(''));
        };

        this.updateUser = function (data) {
            return $http.post([url, 'update'].join(''), data);
        };

        this.createUser = function (data) {
            return $http.post([url, 'create'].join(''), data);
        };

        this.deleteUser = function (id) {
            return $http.get([url, 'delete/?id=', id].join(''));
        };
    });