Skip to content

Commit

Permalink
Merge pull request #2194 from alphagov/13.7.1-merging-patch-into-main
Browse files Browse the repository at this point in the history
13.7.1 merging patch into main
  • Loading branch information
BenSurgisonGDS authored May 26, 2023
2 parents 094e8df + b8c0bb7 commit b330664
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@

- [#2183: Improve the design of the error screen](https://github.com/alphagov/govuk-prototype-kit/pull/2183)

## 13.7.1

### Fixes

- [#2192: Make callbacks optional in the session file store](https://github.com/alphagov/govuk-prototype-kit/pull/2192)

## 13.7.0

### New features
Expand Down
7 changes: 4 additions & 3 deletions lib/session-file-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ const fse = require('fs-extra')
const path = require('path')
const Store = require('express-session').Store

const noop = () => {}
class FileStore extends Store {
constructor (options) {
super()
this.options = options || {}
this.path = this.options.path || './sessions'
}

async set (sessionId, session, callback) {
async set (sessionId, session, callback = noop) {
try {
// Delete any expired sessions before creating a new session
const storedSessionFiles = await fse.readdir(this.path)
Expand Down Expand Up @@ -37,7 +38,7 @@ class FileStore extends Store {
}
}

async get (sessionId, callback) {
async get (sessionId, callback = noop) {
try {
const filename = path.join(this.path, sessionId + '.json')
const session = await fse.readJson(filename)
Expand All @@ -51,7 +52,7 @@ class FileStore extends Store {
}
}

async destroy (sessionId, callback) {
async destroy (sessionId, callback = noop) {
try {
const filename = path.join(this.path, sessionId + '.json')
await fse.remove(filename)
Expand Down
4 changes: 2 additions & 2 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "govuk-prototype-kit",
"description": "Rapidly create HTML prototypes of GOV.UK services",
"version": "13.7.0",
"version": "13.7.1",
"engines": {
"node": "^16.x || >= 18.x"
},
Expand Down

0 comments on commit b330664

Please sign in to comment.