import { adminTokenCookieConfig, userTokenCookieConfig } from './cookie.server'

export const handleCookie = async (request: Request) => {
  const headers = request.headers
  const userToken = (await userTokenCookieConfig.parse(
    headers.get('Cookie'),
  )) as string
  const adminToken = (await adminTokenCookieConfig.parse(
    headers.get('Cookie'),
  )) as string

  return {
    userToken,
    adminToken,
  }
}
