Skip to content

Commit 2dadac0

Browse files
joehecndead-horse
authored andcommitted
fix: param inconsistency (#26)
1 parent dd50baf commit 2dadac0

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

cnode-api-async/app/controller/topics.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,10 @@ module.exports = app => {
5353

5454
async update() {
5555
const { ctx } = this;
56+
const id = ctx.params.id;
5657

5758
ctx.validate(this.createRule);
58-
await ctx.service.topics.update(ctx.params.id, ctx.request.body);
59+
await ctx.service.topics.update(Object.assign({ id }, ctx.request.body));
5960
ctx.status = 204;
6061
}
6162
}

cnode-api/app/controller/topics.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ exports.create = function* () {
4141
};
4242

4343
exports.update = function* () {
44+
const id = this.params.id;
4445
this.validate(createRule);
45-
yield this.service.topics.update(this.params.id, this.request.body);
46+
yield this.service.topics.update(Object.assign({ id }, this.request.body));
4647
this.status = 204;
4748
};

0 commit comments

Comments
 (0)