import { staffTokenCookieConfig, 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 staffToken = (await staffTokenCookieConfig.parse(
    headers.get('Cookie'),
  )) as string

  return {
    userToken,
    staffToken,
  }
}
