import fetchHelper from '../../utils/fetchHelper'
import getTokenHelper from '../../utils/getTokenHelper'

export default defineEventHandler(async (event) => {
  const config = useRuntimeConfig()
  //@ts-ignore
  let token: string = await getTokenHelper(event)
  //@ts-ignore
  setCookie(event, 'logship_user', null)
  
  const res = await fetchHelper(event, 'auth/logout', 'POST', token, {
    token: token,
  })
  if(res) {
    //@ts-ignore
    setCookie(event, 'logship_it', '')
    //setCookie(event, 'logship_rt', '')
  }

  return null
})