diff --git a/site/src/layouts/Base.astro b/site/src/layouts/Base.astro index 9dff883..bf1d2de 100644 --- a/site/src/layouts/Base.astro +++ b/site/src/layouts/Base.astro @@ -104,7 +104,8 @@ try { fetch('/api/me', { credentials: 'include' }) .then(r => { if (r.status === 401 || r.status === 404) { - window.location.replace(authUrl ? authUrl + '/login/' : '/login/'); + const next = authUrl ? '?next=' + encodeURIComponent(window.location.href) : ''; + window.location.replace(authUrl ? authUrl + '/login/' + next : '/login/'); } else { document.body.removeAttribute('data-auth-pending'); }