import type { PageLoad } from './$types';
import { error } from '@sveltejs/kit';
import { server } from '../../../../helpers';

export const load: PageLoad = async ({ fetch, params }) => {
  let resp = await fetch(`${server}/api/change/${params.user}/${params.repo}/get/${params.hash}`);

  if (resp.status == 200) {
    let x = await resp.json();
    console.log(JSON.stringify(x));
    return x;
  } else {
    throw error(resp.status);
  }
};