diff --git a/components/GC.vue b/components/GC.vue index af579ef..d1aa47a 100644 --- a/components/GC.vue +++ b/components/GC.vue @@ -73,7 +73,7 @@ function filterLastByMonth(contributions: Day[], month: number) { return contributions.filter(day => range.includes(day.date)) } -onMounted(async () => { +watch(() => props.username, async () => { loading.value = true const data = await fetchContribution(props.username) @@ -95,11 +95,11 @@ onMounted(async () => { loading.value = false } -}) +}, { immediate: true }) -async function fetchContribution(name: string, _year = 'last') { +async function fetchContribution(name: string, year = 'last') { const { data } = await useFetch('/api/contribution', { - query: { name, year: _year }, + query: { name, year }, }) return toValue(data) @@ -107,63 +107,65 @@ async function fetchContribution(name: string, _year = 'last') { - - - - diff --git a/pages/index.vue b/pages/index.vue index 45850b8..0139a0b 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -51,7 +51,7 @@ const { data: user } = await useFetch('/api/user')

- +