Skip to content

Commit

Permalink
fix: multiple redirects on switching to another locale
Browse files Browse the repository at this point in the history
  • Loading branch information
rchl committed Aug 31, 2019
1 parent af06e99 commit 14ceeb3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/plugins/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,11 @@ export default async (context) => {
if (!initialSetup && STRATEGY !== STRATEGIES.NO_PREFIX) {
const route = app.i18n.__route
const routeName = route && route.name ? app.getRouteBaseName(route) : 'index'
const redirectPath = app.localePath(Object.assign({}, route, { name: routeName }), newLocale)

redirect(app.localePath(Object.assign({}, route , {
name: routeName
}), newLocale))
if (route && route.path !== redirectPath) {
redirect(redirectPath)
}
}
}

Expand Down

0 comments on commit 14ceeb3

Please sign in to comment.