From a9e6220a0d2a804ebb6b86f7e877f0f7c254acdb Mon Sep 17 00:00:00 2001 From: Ignacy Date: Thu, 31 Mar 2016 16:54:34 +0200 Subject: [PATCH] posting cg with random id --- client/frontend/core/main_view_vm.js | 26 +++++++++----------------- client/frontend/core/mockup_data.js | 9 +++++++-- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/client/frontend/core/main_view_vm.js b/client/frontend/core/main_view_vm.js index e85f33a..9244dc6 100644 --- a/client/frontend/core/main_view_vm.js +++ b/client/frontend/core/main_view_vm.js @@ -112,23 +112,15 @@ function MainViewModel() { }); } - // self.SendCrashGroup = function () { - // - // var crashGroup = { - // - // }; - // - // $.ajax({ - // url: "http://private-anon-7dff37ec3-dpcs.apiary-mock.com/vd1/crash-groups", - // type: "PUT" - // }) - // .done(function (response) { - // var data = response; - // var g = new GroupVM(data, self); - // self.crashGroupsData.push(g); - // }); - // } - // + self.SendCrashGroup = function () { + $.ajax(Repository.CrashGroups.post()) + .done(function (response) { + var data = response; + var g = new GroupVM(data, self); + self.crashGroupsData.push(g); + }); + } + self.GroupToView = ko.observable(new GroupVM({}, self)); self.ViewCrashGroup = function (group) { diff --git a/client/frontend/core/mockup_data.js b/client/frontend/core/mockup_data.js index ae11eff..41e2012 100644 --- a/client/frontend/core/mockup_data.js +++ b/client/frontend/core/mockup_data.js @@ -280,11 +280,16 @@ var crashGroups = { }; }, - post: function (data) { + post: function () { + var id = Math.round(Math.random()*100000); + var crashGroup = { + crash_group_id: id, + crash_group_url: "/vd1/crash-reports/"+id + }; return { url: this.url, type: "POST", - data: data + data: crashGroup }; }, };