import { string } from 'alga-js'
import strapiHelper from "../../utils/strapiHelper"

export default defineEventHandler(async (event) => {
  let data: any = {}

  try {
    const res: any = await strapiHelper(event, `m-products/1`, 'GET', null)
    if(res) {
      data = res
    }
  } catch(error: any) {
    console.log(error)
    data = {
      status: error.status || error.statusCode || 500,
      message: error.detail || error.message || error.statusMessage
    }
  }

  return data
})