Remove fancy js features

This commit is contained in:
Arti Zirk 2017-06-10 22:25:11 +03:00
parent b8f0f00bdf
commit 85e046f2dd
2 changed files with 10 additions and 9 deletions

View File

@ -14,19 +14,19 @@
function getContact(id) { function getContact(id) {
if(!id) return if(!id) return
$http.get(`/api/contacts/${id}`).then(resp => { $http.get("/api/contacts/"+id).then(function(resp) {
vm.contact = resp.data; vm.contact = resp.data;
}); });
}; };
function submitForm() { function submitForm() {
console.log(vm.contact); console.log("submitting contact", vm.contact);
if(vm.contact._id) { if(vm.contact._id) {
$http.put(`/api/contacts/${vm.contact._id}`, vm.contact).then(resp => { $http.put("/api/contacts/"+vm.contact._id, vm.contact).then(function(resp){
$location.path("/search"); $location.path("/search");
}); });
} else { } else {
$http.post(`/api/contacts`, vm.contact).then(resp => { $http.post("/api/contacts", vm.contact).then(function(resp){
$location.path("/search"); $location.path("/search");
}); });
} }

View File

@ -15,17 +15,18 @@
getContacts(); getContacts();
function getContacts() { function getContacts() {
$http.get("/api/contacts").then(resp => { $http.get("/api/contacts").then(function(resp){
vm.contacts = resp.data; vm.contacts = resp.data;
}).catch(e => { }).catch(function(e) {
console.error("Failed to get contacts", e); console.error("Failed to get contacts", e);
}) })
}; };
function deleteContact(id) { function deleteContact(id) {
modalService.confirm().then(resp => { modalService.confirm().then(function(resp) {
$http.delete(`/api/contacts/${id}`).then(resp => { $http.delete("/api/contacts/"+id).then(function(resp) {
console.info(`Contact ${id}`) console.log("Deleted contact "+id)
getContacts(); getContacts();
}) })
}) })