Skip to content

Commit

Permalink
fixed ts errors
Browse files Browse the repository at this point in the history
  • Loading branch information
MahitGtg committed Jan 13, 2025
1 parent 513ee1a commit 5efc911
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions client/src/views/LeaderboardView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { ref, onMounted } from 'vue'
import { useUserStore } from '@/stores/user'
import server from '@/utils/server'
// These interfaces should match exactly what we're working with
interface LeaderboardApiEntry {
username: string
total_points: number
Expand All @@ -17,6 +18,7 @@ interface LeaderboardEntry {
avatarIndex: number
name: string
points: number
isHighlighted: boolean
}
const userStore = useUserStore()
Expand All @@ -28,7 +30,7 @@ const error = ref<string | null>(null)
const fetchLeaderboard = async () => {
try {
isLoading.value = true
const response = await server.get('/leaderboard/', {
const response = await server.get<LeaderboardApiEntry[]>('/leaderboard/', {
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
Expand All @@ -37,7 +39,10 @@ const fetchLeaderboard = async () => {
const data: LeaderboardApiEntry[] = response.data
const transformEntry = (entry: LeaderboardApiEntry, highlight: boolean = false) => ({
const transformEntry = (
entry: LeaderboardApiEntry,
highlight: boolean = false,
): LeaderboardEntry => ({
rank: entry.rank,
avatarIndex: entry.avatar,
name: entry.username,
Expand Down

0 comments on commit 5efc911

Please sign in to comment.