fix typescript errors and update dependencies

This commit is contained in:
itsrubberduck
2026-02-17 18:13:04 +01:00
parent 25e4f77ca3
commit 4a01593612
14 changed files with 3215 additions and 2544 deletions

View File

@@ -1,5 +1,6 @@
import { defineEventHandler } from 'h3'
export default defineEventHandler(async () => {
return await $fetch('https://data.vatsim.net/v3/vatsim-data.json')
const fetcher = (globalThis as any).$fetch as (url: string, options?: Record<string, unknown>) => Promise<unknown>
return await fetcher('https://data.vatsim.net/v3/vatsim-data.json')
})

View File

@@ -1,9 +1,17 @@
import {defineEventHandler, getRouterParam} from 'h3'
import { createError, defineEventHandler, getQuery } from 'h3'
export default defineEventHandler(async (event) => {
const {cid} = getQuery(event)
if (!cid) throw createError({statusCode: 400, statusMessage: 'cid required'})
const query = getQuery(event)
const rawCid = Array.isArray(query.cid) ? query.cid[0] : query.cid
if (rawCid === undefined || rawCid === null) {
throw createError({ statusCode: 400, statusMessage: 'cid required' })
}
const cid = String(rawCid).trim()
if (!cid) {
throw createError({ statusCode: 400, statusMessage: 'cid required' })
}
const url = `https://api.vatsim.net/v2/members/${encodeURIComponent(cid)}/flightplans`
return await $fetch(url, {method: 'GET'})
const fetcher = (globalThis as any).$fetch as (target: string, options?: Record<string, unknown>) => Promise<unknown>
return await fetcher(url, { method: 'GET' })
})