fix(auth): use API_INTERNAL_URL in userGroup hook
The userGroup hook was hardcoding http://localhost:8080 instead of reading API_INTERNAL_URL from the environment. In Docker this caused the /api/users/me fetch to fail silently, leaving event.locals.user unset and triggering the handleAuth guard to redirect every page to /login — including the login form action itself, creating an infinite redirect loop. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -27,7 +27,8 @@ const userGroup: Handle = async ({ event, resolve }) => {
|
||||
|
||||
if (auth) {
|
||||
try {
|
||||
const response = await fetch('http://localhost:8080/api/users/me', {
|
||||
const apiUrl = env.API_INTERNAL_URL || 'http://localhost:8080';
|
||||
const response = await fetch(`${apiUrl}/api/users/me`, {
|
||||
headers: { Authorization: auth }
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user