debug: add console logs to switchLocale
This commit is contained in:
@@ -48,10 +48,13 @@ export default function Header({ locale = "sr" }: HeaderProps) {
|
||||
setLangDropdownOpen(false);
|
||||
return;
|
||||
}
|
||||
console.log("Switching from", locale, "to", newLocale);
|
||||
console.log("Current pathname:", pathname);
|
||||
document.cookie = `NEXT_LOCALE=${newLocale}; path=/; max-age=31536000`;
|
||||
const pathWithoutLocale = pathname.replace(/^\/(sr|en|de|fr)/, "") || "/";
|
||||
const newPath = `/${newLocale}${pathWithoutLocale}`;
|
||||
window.location.href = newPath;
|
||||
console.log("Navigating to:", newPath);
|
||||
window.location.replace(newPath);
|
||||
setLangDropdownOpen(false);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user