Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,18 @@ req.session.save(function(err) {
})
```

#### Session.save().then(callback)

You can use Promise type as return

Example
```js
await req.session.save()
.then(()=>{
// session saved
})
```

#### Session.touch()

Updates the `.maxAge` property. Typically this is
Expand Down
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ function session(options) {
debug('saving %s', this.id);
savedHash = hash(this);
_save.apply(this, arguments);
return this.req.sessionStore.setPromise;
}

Object.defineProperty(sess, 'reload', {
Expand Down
2 changes: 1 addition & 1 deletion session/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ defineMethod(Session.prototype, 'resetMaxAge', function resetMaxAge() {
*/

defineMethod(Session.prototype, 'save', function save(fn) {
this.req.sessionStore.set(this.id, this, fn || function(){});
this.req.sessionStore.setPromise = this.req.sessionStore.set(this.id, this, fn || function(){});
return this;
});

Expand Down