Skip to content

Commit

Permalink
docs: fix const define (#1249)
Browse files Browse the repository at this point in the history
  • Loading branch information
atian25 authored Jul 28, 2017
1 parent 45bea3c commit 4f2ebfd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ test/fixtures
examples/**/app/public
logs
run
docs/node_modules
4 changes: 2 additions & 2 deletions docs/source/zh-cn/core/cookie-and-session.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ HTTP 请求都是无状态的,但是我们的 Web 应用通常都需要知道

```js
exports.add = function* (ctx) {
const count = ctx.cookies.get('count');
let count = ctx.cookies.get('count');
count = count ? Number(count) : 0;
ctx.cookies.set('count', ++count);
ctx.body = count;
};

exports.remove = function* (ctx) {
const count = ctx.cookies.set('count', null);
ctx.cookies.set('count', null);
ctx.status = 204;
};
```
Expand Down

0 comments on commit 4f2ebfd

Please sign in to comment.