import { adminGetUser } from "$lib/services";
import { error } from "@sveltejs/kit";

export async function load({ params, cookies }) {
  const token = cookies.get("session_token") || "";
  const user = await adminGetUser(params.id, token).catch(() => null);
  if (!user) throw error(404, "User not found");
  return { user };
}
