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) {
if(!id) return
$http.get(`/api/contacts/${id}`).then(resp => {
$http.get("/api/contacts/"+id).then(function(resp) {
vm.contact = resp.data;
});
};
function submitForm() {
console.log(vm.contact);
console.log("submitting contact", vm.contact);
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");
});
} else {
$http.post(`/api/contacts`, vm.contact).then(resp => {
$http.post("/api/contacts", vm.contact).then(function(resp){
$location.path("/search");
});
}

View File

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