-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(reroute): Allow for dynamic asynchronously rerouting #13176
Closed
Labels
feature / enhancement
New feature or request
Comments
An example of how this could work: import type { Reroute } from '@sveltejs/kit';
export const reroute: Reroute = async ({ url }) => {
if (url.pathname.startsWith('/api')) {
return;
}
const response = await fetch(url.protocol + '//' + url.host + '/api/locales');
const locales = await response.json(); // as Type[];
// write re-routing logic here
}; |
6 tasks
6 tasks
dummdidumm
added a commit
that referenced
this issue
Feb 5, 2025
dummdidumm
added a commit
that referenced
this issue
Feb 28, 2025
dummdidumm
added a commit
that referenced
this issue
Mar 4, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the problem
The current SvelteKit Reroute functionality doesn't support dynamic rerouting for localization where settings are stored in a database. We need to implement a multi-domain, multi-prefix localization system that allows flexible domain/language combinations.
Example configuration:
Domain/prefix mappings:
Describe the proposed solution
Modify the Reroute function to return
MaybePromise<void | string>
and update its implementation inserver/response.js
andclient/client.js
.A proof-of-concept implementation: nikosgram@70d808e
I would appreciate feedback on this approach to ensure I'm not overlooking any potential issues or better alternatives.
Alternatives considered
No response
Importance
i cannot use SvelteKit without it
Additional Information
No response
The text was updated successfully, but these errors were encountered: