feat(web): continue after login (#18302)

This commit is contained in:
Jason Rasmussen 2025-05-15 14:45:23 -04:00 committed by GitHub
parent 6117329057
commit c046651f23
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
34 changed files with 65 additions and 63 deletions

View file

@ -50,7 +50,7 @@ const hasAuthCookie = (): boolean => {
return false;
};
export const authenticate = async (options?: AuthOptions) => {
export const authenticate = async (url: URL, options?: AuthOptions) => {
const { public: publicRoute, admin: adminRoute } = options || {};
const user = await loadUser();
@ -59,7 +59,7 @@ export const authenticate = async (options?: AuthOptions) => {
}
if (!user) {
redirect(302, AppRoute.AUTH_LOGIN);
redirect(302, `${AppRoute.AUTH_LOGIN}?continue=${encodeURIComponent(url.pathname + url.search)}`);
}
if (adminRoute && !user.isAdmin) {