Replies: 4 comments 2 replies
-
I have a similar use-case and am also interested in solutions. |
Beta Was this translation helpful? Give feedback.
-
I solve this problem by having an (ES6) module for the client, for which I set fetch from SvelteKit during the life cycle. Then I import this module in the places where I need it and all API calls go from there. |
Beta Was this translation helpful? Give feedback.
-
i have the same problem. Looking for a solution :) . |
Beta Was this translation helpful? Give feedback.
-
This is a known limitation and since we are approaching version 2 it is time to bring it up again. A new issue should be created or if there is an open one already make some noice over there. |
Beta Was this translation helpful? Give feedback.
-
I have a large app with a lot of lib code. The page endpoints call this lib code from different points in my app. Because load is only available in load functions, I have to pass fetch to every single function that calls my backend for getting or posting some json.
I find it very ugly. I have tried assigning fetch to a global variable but that didn't work. In the source code of kit I cannot find an export for the load function. How can I import it (at most once per lib file) and drop all those fetch arguments?
Beta Was this translation helpful? Give feedback.
All reactions