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

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

  let endpointFactory = new EndpointFactory(fetch);
  let readUsersEndpoint = endpointFactory.createReadUsersEndpoint();

  return {
    endpointFactory: endpointFactory,
    users: readUsersEndpoint.call()
  };
}

export interface UserListPage {
  endpointFactory: EndpointFactory,
  users: User[]
}
