import { data } from 'react-router'

import { setUserLogoutHeaders } from '~/libs/logout-header.server'

export const action = async () => {
  try {
    const responseHeaders = setUserLogoutHeaders()

    return data(
      { success: true },
      { headers: responseHeaders, status: 200, statusText: 'OK' },
    )
  } catch {
    return data(
      {
        message: 'Something went wrong',
        success: false,
      },
      { status: 500 },
    )
  }
}
