self.submitOwnerForm = function()

in 4-serverless-cicd-stack/static-service-cicd/static-resource/scripts/owner-form/owner-form.controller.js [17:34]


        self.submitOwnerForm = function () {
            var id = self.owner.id;
            var req;
            if (id) {
                req = $http.put(_baseUrl + "api/customer/owners/" + id, self.owner);
            } else {
                req = $http.post(_baseUrl + "api/customer/owners", self.owner);
            }

            req.then(function () {
                $state.go('owners');
            }, function (response) {
                var error = response.data;
                alert(error.error + "\r\n" + error.errors.map(function (e) {
                        return e.field + ": " + e.defaultMessage;
                    }).join("\r\n"));
            });
        };