Skip to content

Commit 7b08dfe

Browse files
committed
fix: switching to en on root was broken
1 parent ac36923 commit 7b08dfe

File tree

1 file changed

+4
-5
lines changed
  • web/src/apps/main/redux/reducers/settings

1 file changed

+4
-5
lines changed

web/src/apps/main/redux/reducers/settings/index.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,11 @@ export const settings = (
4242
action.payload.language.code === "en" ? "" : `/${action.payload.language.code}`;
4343

4444
if (match?.params.lang || langPrefix) {
45-
history.push({
46-
...history.location,
47-
pathname: match?.params.lang
45+
const pathname =
46+
(match?.params.lang
4847
? history.location.pathname.replace(`/${match.params.lang}`, langPrefix)
49-
: `${langPrefix}${history.location.pathname}`,
50-
});
48+
: `${langPrefix}${history.location.pathname}`) || "/";
49+
history.push({ ...history.location, pathname });
5150
}
5251
}
5352
return { ...state, ...action.payload };

0 commit comments

Comments
 (0)