Skip to content

Commit

Permalink
fix: Fix broken condition in middleware & prevent cookie from being s…
Browse files Browse the repository at this point in the history
…et twice (#164)
  • Loading branch information
Magnum5234 authored and paulgv committed Jan 23, 2019
1 parent 07294e3 commit 7c83922
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/templates/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,6 @@ middleware['i18n'] = async ({ app, req, res, route, store, redirect, isHMR }) =>
redirectToLocale = browserLocale
}

if(useCookie){
setCookie(redirectToLocale || 1)
}

if (redirectToLocale && redirectToLocale !== app.i18n.locale && locales.indexOf(redirectToLocale) !== -1) {

// We switch the locale before redirect to prevent loops
Expand All @@ -137,5 +133,5 @@ middleware['i18n'] = async ({ app, req, res, route, store, redirect, isHMR }) =>
}
}

await switchLocale(locale = routeLocale ? routeLocale : locale)
await switchLocale(routeLocale ? routeLocale : locale)
}

0 comments on commit 7c83922

Please sign in to comment.