mirror of
https://github.com/BlossomiShymae/clean-cuts.git
synced 2025-12-06 10:10:47 +01:00
12 lines
335 B
TypeScript
12 lines
335 B
TypeScript
export default async function useLocalizedData<T>(producer: (locale: string) => Promise<T>) {
|
|
const { currentLocale } = useLocale();
|
|
const data = ref(await producer(currentLocale.value));
|
|
watch(currentLocale, async () => {
|
|
data.value = await producer(currentLocale.value);
|
|
});
|
|
|
|
return {
|
|
currentLocale,
|
|
data
|
|
};
|
|
} |