Also redirect to /settings/connections when disconnecting from a provider page

This commit is contained in:
Ullrich Schäfer 2026-05-23 20:46:52 +02:00
parent 12371d8c89
commit da3659e07a
No known key found for this signature in database
GPG key ID: A32FF691A0F752D9

View file

@ -17,6 +17,11 @@ export async function action({ params, request }: Route.ActionArgs) {
const referer = request.headers.get("referer");
const url = referer ? new URL(referer) : null;
const back = url?.pathname.startsWith("/settings") ? url.pathname : "/settings/connections";
// If coming from a provider-specific settings page, go up to /settings/connections.
// Otherwise return to wherever the user was within /settings.
let back = "/settings/connections";
if (url?.pathname.startsWith("/settings") && !url.pathname.startsWith("/settings/connections/")) {
back = url.pathname;
}
return redirect(back);
}