import {
    readRawBody,
    getQuery,
    getMethod
} from 'h3'

/**
 * 获取新闻类型列表
 */
export default defineEventHandler(async (event) => {
    // 基础url
    const baseURL = process.env.NUXT_PROXY_WEB_API
    const method = getMethod(event).toUpperCase()
    let body
    if (method !== 'GET') body = await readRawBody(event)
    const res = await $fetch(baseURL + "/News.News/getNewsType", {
        method,
        baseURL: event.context.baseUrl,
        headers: event.context.headers,
        params: getQuery(event),
        body
    })
    return res
})