Closed that1guy closed 9 years ago
Can you add to this bug the payload you are sending via the request?
Sent from my iPhone
On Feb 24, 2015, at 3:32 PM, Brad Davis notifications@github.com wrote:
I can lookup the offer with this GET request.
However if I try to POST to accept the offer I get error
TypeError: Cannot read property 'offerId' of undefined at Object.self.acceptOffer (/Users/braddavis/WebstormProjects/htsApp/api/posting-api/lib/models/offers.js:101:35) at /Users/braddavis/WebstormProjects/htsApp/api/posting-api/lib/routes/postings.js:126:17 at Layer.handle as handle_request at next (/Users/braddavis/WebstormProjects/htsApp/api/posting-api/node_modules/express/lib/router/route.js:110:13) at Route.dispatch (/Users/braddavis/WebstormProjects/htsApp/api/posting-api/node_modules/express/lib/router/route.js:91:3) at Layer.handle as handle_request at /Users/braddavis/WebstormProjects/htsApp/api/posting-api/node_modules/express/lib/router/index.js:267:22 at param (/Users/braddavis/WebstormProjects/htsApp/api/posting-api/node_modules/express/lib/router/index.js:340:14) at param (/Users/braddavis/WebstormProjects/htsApp/api/posting-api/node_modules/express/lib/router/index.js:356:14) at param (/Users/braddavis/WebstormProjects/htsApp/api/posting-api/node_modules/express/lib/router/index.js:356:14) at Function.proto.process_params (/Users/braddavis/WebstormProjects/htsApp/api/posting-api/node_modules/express/lib/router/index.js:400:3) at next (/Users/braddavis/WebstormProjects/htsApp/api/posting-api/node_modules/express/lib/router/index.js:261:10) at Function.proto.handle (/Users/braddavis/WebstormProjects/htsApp/api/posting-api/node_modules/express/lib/router/index.js:166:3) at router (/Users/braddavis/WebstormProjects/htsApp/api/posting-api/node_modules/express/lib/router/index.js:35:12) at Layer.handle as handle_request at trim_prefix (/Users/braddavis/WebstormProjects/htsApp/api/posting-api/node_modules/express/lib/router/index.js:302:13) at /Users/braddavis/WebstormProjects/htsApp/api/posting-api/node_modules/express/lib/router/index.js:270:7 at Function.proto.process_params (/Users/braddavis/WebstormProjects/htsApp/api/posting-api/node_modules/express/lib/router/index.js:321:12) at Object.next as _onImmediate at processImmediate as _immediateCallback Here's my code that is submitting the offer acceptance.
factory.acceptOffer = function (postingId, offerId, payload) {
console.log('postingId', postingId); <---- 87e8462c658144ae98e56ad456b420c4 console.log('offerId', offerId); <---- 53738a8684aa4064a6f9c029060bd42d console.log('accepting this offer', offer); <---- Object {when: "2015-02-03T13:15:00.000Z", where: "4155 Stevens Creek Boulevard, Santa Clara, CA 95051, United States"} var deferred = $q.defer(); $http({ method: 'POST', url: ENV.postingAPI + postingId + "/offers/" + offerId + "/accept", data: offer }).then(function (response, status, headers, config) { deferred.resolve(true); }, function (err, status, headers, config) { deferred.reject(err); }); return deferred.promise; };
— Reply to this email directly or view it on GitHub.
Not sure I understand what you mean..
I can lookup the offer with this GET request.
http://localhost:4043/v1/postings/87e8462c658144ae98e56ad456b420c4/offers/53738a8684aa4064a6f9c029060bd42d
However if I try to POST to accept the offer I get error
Here's my code that is submitting the offer acceptance.