import { EndpointFactory } from '$lib/api/endpoints';
import type { User } from '$lib/api/types';

/** @type {import('./$types').PageLoad} */
export async function load({ fetch, params }) {

  let endpointFactory = new EndpointFactory(fetch);
  let readUserEndpoint = endpointFactory.createReadUserEndpoint(params.user);

  return {
    endpointFactory: endpointFactory,
    user: readUserEndpoint.call()
  };
}

export interface UserProfilePage {
  endpointFactory: EndpointFactory,
  user: User
}
