Skip to content

Commit

Permalink
one api url source
Browse files Browse the repository at this point in the history
  • Loading branch information
ignacy130 committed Mar 31, 2016
1 parent 992de94 commit 13bd0cf
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 33 deletions.
6 changes: 3 additions & 3 deletions client/frontend/core/main_view_vm.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,14 @@ function MainViewModel() {
// })["crash_group_url"];
//
// $.ajax({
// url: "http://private-anon-71b931be7-dpcs.apiary-mock.com/vd1/crash-reports/" + report.id,
// url: API_URL + "/vd1/crash-reports/" + report.id,
// type: "GET",
// })
// .done(function (response) {
// response["crash_report"]["crash_group_id"] = self.selectedId
// response["crash_report"]["crash_group_url"] = self.crashGroupUrl
// $.ajax({
// url: "http://private-anon-71b931be7-dpcs.apiary-mock.com/vd1/crash-reports/" + report.id,
// url: API_URL + "/vd1/crash-reports/" + report.id,
// type: "PUT",
// data: {
// "crash_report": response
Expand Down Expand Up @@ -114,7 +114,7 @@ function MainViewModel() {
};

$.ajax({
url: "http://private-anon-71b931be7-dpcs.apiary-mock.com/vd1/crash-reports/",
url: API_URL + "/vd1/crash-reports/",
type: "POST",
data: {
"crash_report": crashReport
Expand Down
46 changes: 16 additions & 30 deletions client/frontend/core/mockup_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,13 @@ var Mock = {
],
};

var apiary_url = API_URL + "";
var server_url = "http://54.93.105.103:8000";

var API_URL = server_url;

var crashReports = {
url: "http://private-anon-71b931be7-dpcs.apiary-mock.com/vd1/crash-reports/",
url: API_URL + "/vd1/crash-reports/",

all: function () {
return {
Expand Down Expand Up @@ -252,59 +257,40 @@ var crashReports = {
};

var crashGroups = {
url: "http://private-anon-71b931be7-dpcs.apiary-mock.com/vd1/crash-groups/",
url: API_URL + "/vd1/crash-groups/",

all: function () {
$.ajax(crashReports.all())
.done(function (response) {
var ids = Enumerable.From(response)
.Select(
function (crash) {
return crash.crash_report.crash_group_id;
})
.ToArray();
var groups = [];

var groupsRequests = [];

for (var i = 0; i < ids.length; i++) {
groupsRequests.push($.ajax(crashGroups.get(ids[i])));
}

$.when.apply(undefined, groupsRequests).then(
function(results){
groups = results[0];
return groups;
})
});
all: function (id) {
return {
url: this.url + "?format=json",
type: "GET",
};
},

get: function (id) {
return {
url: this.url + id,
type: "GET",
}
};
},

put: function (id, data) {
return {
url: this.url + id,
type: "PUT",
data: data
}
};
},

post: function (data) {
return {
url: this.url,
type: "POST",
data: data
}
};
},
};

var solutions = {
url: "http://private-anon-71b931be7-dpcs.apiary-mock.com/vd1/solutions/",
url: API_URL + "/vd1/solutions/",

all: function (query) {
if (!query) {
Expand Down

0 comments on commit 13bd0cf

Please sign in to comment.