import type { Load } from '@sveltejs/kit' ; interface SvemixLoadHandler { routesName : string ; } export default function loadHandler ( { routesName } ) { return async ( { session , url , stuff , fetch , params } ) => { const _accessSession = session ?. something ; try { const response = await fetch ( routesName , { credentials : 'include' , headers : { 'content-type' : 'application/json' } } ) ; if ( ! response . ok ) { throw new Error ( 'An unknown error occured' ) ; } const loaded = await response . json ( ) ; return loaded ; } catch ( err ) { return { error : err , status : 500 } ; } } ; }