Update language support and localization across components. Change HTML language attribute to English, add i18next for translations, and refactor feedback forms to utilize localized strings. Remove unused constants and adjust product handling in lead forms. Enhance accessibility and improve code structure.
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import ky from "ky";
|
||||
import { useLocationSearch } from "@/hooks/useLocationSearch";
|
||||
import { parseLangParam } from "@/lib/urlLang";
|
||||
import { queryKeys } from "@/queries/keys";
|
||||
|
||||
const COUNTRY_CODE_URL = "https://stream.graff.tech/api/getCountryCode";
|
||||
|
||||
export async function fetchCountryCode(): Promise<{ countryCode: string }> {
|
||||
return ky.get(COUNTRY_CODE_URL).json<{ countryCode: string }>();
|
||||
}
|
||||
|
||||
export function useCountryCodeQuery() {
|
||||
const search = useLocationSearch();
|
||||
const langFromUrl = parseLangParam(
|
||||
new URLSearchParams(search).get("lang")
|
||||
);
|
||||
|
||||
return useQuery({
|
||||
queryKey: queryKeys.countryCode,
|
||||
queryFn: fetchCountryCode,
|
||||
enabled: langFromUrl === null,
|
||||
staleTime: 24 * 60 * 60 * 1000,
|
||||
retry: 2,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user