fix: set language code before initializing checkout
This commit is contained in:
@@ -55,16 +55,14 @@ export default function Header({ locale: propLocale = "sr" }: HeaderProps) {
|
||||
setLangDropdownOpen(false);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
initCheckout();
|
||||
}, [initCheckout]);
|
||||
|
||||
// Set language code for checkout based on current locale
|
||||
// Set language code first, then initialize checkout
|
||||
useEffect(() => {
|
||||
if (locale) {
|
||||
setLanguageCode(locale);
|
||||
// Initialize checkout after language code is set
|
||||
initCheckout();
|
||||
}
|
||||
}, [locale, setLanguageCode]);
|
||||
}, [locale, setLanguageCode, initCheckout]);
|
||||
|
||||
useEffect(() => {
|
||||
const handleScroll = () => {
|
||||
|
||||
Reference in New Issue
Block a user