import { useGetProfile } from "../useAuth";

export const usePreferredLanguage = () => {
  const { data } = useGetProfile();

  if (!data || !data.lang_code) {
    return navigator.languages && navigator.languages.length
      ? navigator.languages[0]
      : navigator.language;
  }

  return data.lang_code;
};
