Skip to content

Commit 7c83922

Browse files
Magnum5234paulgv
authored andcommitted
fix: Fix broken condition in middleware & prevent cookie from being set twice (#164)
1 parent 07294e3 commit 7c83922

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/templates/middleware.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,6 @@ middleware['i18n'] = async ({ app, req, res, route, store, redirect, isHMR }) =>
118118
redirectToLocale = browserLocale
119119
}
120120

121-
if(useCookie){
122-
setCookie(redirectToLocale || 1)
123-
}
124-
125121
if (redirectToLocale && redirectToLocale !== app.i18n.locale && locales.indexOf(redirectToLocale) !== -1) {
126122

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

140-
await switchLocale(locale = routeLocale ? routeLocale : locale)
136+
await switchLocale(routeLocale ? routeLocale : locale)
141137
}

0 commit comments

Comments
 (0)