Skip to content

Commit

Permalink
posting cg with random id
Browse files Browse the repository at this point in the history
  • Loading branch information
ignacy130 committed Mar 31, 2016
1 parent 7f23fe4 commit a9e6220
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 19 deletions.
26 changes: 9 additions & 17 deletions client/frontend/core/main_view_vm.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
9 changes: 7 additions & 2 deletions client/frontend/core/mockup_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
},
};
Expand Down

0 comments on commit a9e6220

Please sign in to comment.