// Clerkless Auth migration
export const upgradeAuth = async (sessionToken: string) => {
  const res = await fetch(
    `${process.env.NEXT_PUBLIC_AUTH_BASE}/v1/client/upgrade`,
    {
      method: 'POST',
      headers: {
        Authorization: sessionToken,
        'Content-Type': 'application/json',
      },
      credentials: 'include',
    }
  );

  if (!res.ok) {
    throw new Error(`Failed to upgrade auth: ${res.statusText}`);
  }

  return res;
};
