mirror of
https://github.com/BlossomiShymae/clean-cuts.git
synced 2025-12-06 18:20:47 +01:00
Add i18n support for data
This commit is contained in:
@@ -49,14 +49,22 @@
|
||||
import Badge from '~/components/Badge.vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import useClient from '../../../composables/useClient';
|
||||
import useLocale from '~/composables/useLocale';
|
||||
|
||||
const route = useRoute();
|
||||
const id = route.params.id as unknown;
|
||||
|
||||
const { client } = useClient();
|
||||
const champion = await client.champions.getAsync(id as number, {locale: "default", version: "latest"});
|
||||
const currentSkin = ref(champion.skins[0].getLoadScreen('latest'));
|
||||
const { currentLocale } = useLocale();
|
||||
const getChampion = async () => await client.champions.getAsync(id as number, {locale: currentLocale.value, version: "latest"});
|
||||
|
||||
const champion = ref(await getChampion());
|
||||
watch(currentLocale, async () => {
|
||||
champion.value = await getChampion();
|
||||
});
|
||||
|
||||
const currentSkin = ref(champion.value.skins[0].getLoadScreen('latest'));
|
||||
const swapLoadScreen = (id: number) => {
|
||||
currentSkin.value = champion.skins.find((x) => x.id == id)?.getLoadScreen('latest') as string;
|
||||
currentSkin.value = champion.value.skins.find((x) => x.id == id)?.getLoadScreen('latest') as string;
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user