any typescript genius can help with writing a wrapper function for a SvelteKit loader ?
the way that the auth library i'm working with works, is that it recommends reading in the auth from the request (after being processed by hooks), and redirecting in the pager loader.
so for a bunch of my pages, i'm gonna want almost the same structure, with computation specific to the page:
naturally, i'd like to extract the repetitive logic so i don't have to write it every time i make a page that's protected. i was thinking something such that it works like
any thoughts? essentially all implementations i'm able to come up with just entirely break Svelte's type system when loading the data in
1 Reply
my best attempt at the implementation
honestly, even something such as where
protect
is defined as such:
i think the type of data in returnWithUser
is my issue? or just something surrounding Svelte's loader type implementation