Skip to content

Commit

Permalink
fix: Set i18n_redirect cookie path to '/' (#143)
Browse files Browse the repository at this point in the history
  • Loading branch information
Effe-Ickx authored and paulgv committed Jan 14, 2019
1 parent 57f1ea1 commit 9ad540e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/templates/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,13 @@ middleware['i18n'] = async ({ app, req, res, route, store, redirect, isHMR }) =>
const date = new Date()
if (isSpa) {
Cookies.set(cookieKey, locale, {
expires: new Date(date.setDate(date.getDate() + 365))
expires: new Date(date.setDate(date.getDate() + 365)),
path: '/'
})
} else if (res) {
const redirectCookie = cookie.serialize(cookieKey, locale, {
expires: new Date(date.setDate(date.getDate() + 365))
expires: new Date(date.setDate(date.getDate() + 365)),
path: '/'
})
res.setHeader('Set-Cookie', redirectCookie)
}
Expand Down

0 comments on commit 9ad540e

Please sign in to comment.