diff --git a/frontend/pages/champion/[alias].vue b/frontend/pages/champion/[alias].vue
index 1532ee6..0dbeadb 100644
--- a/frontend/pages/champion/[alias].vue
+++ b/frontend/pages/champion/[alias].vue
@@ -27,8 +27,8 @@ function updateState(newState : string, newLane : number) {
-
-
+
+
Sorry, there is no data for this champion :(
diff --git a/frontend/server/api/champions.js b/frontend/server/api/champions.ts
similarity index 53%
rename from frontend/server/api/champions.js
rename to frontend/server/api/champions.ts
index 6f54fa8..ad0645e 100644
--- a/frontend/server/api/champions.js
+++ b/frontend/server/api/champions.ts
@@ -1,17 +1,20 @@
+import { MongoClient } from 'mongodb';
import {connectToDatabase, fetchLatestPatch} from '../utils/mongo'
-async function champions(client, patch) {
+async function champions(client: MongoClient, patch: string) {
const database = client.db("champions");
const collection = database.collection(patch);
- const data = await collection.find().toArray()
+ const data : Array = (await collection.find().toArray()) as unknown as Array
data.map((x) => {
- delete x.runes
- delete x.builds
+ for(let lane of x.lanes) {
+ delete lane.builds
+ delete lane.runes
+ }
})
return data
}
-export default defineEventHandler(async (event) => {
+export default defineEventHandler(async (_) => {
const client = await connectToDatabase();
const latestPatch = await fetchLatestPatch(client);
diff --git a/frontend/types/api.ts b/frontend/types/api.ts
index e7b9401..38bb5fb 100644
--- a/frontend/types/api.ts
+++ b/frontend/types/api.ts
@@ -25,8 +25,8 @@ declare global {
losingMatches: number
winrate: number
pickrate: number
- runes: Array
- builds: Builds
+ runes?: Array
+ builds?: Builds
}
type ChampionData = {