fix: allow unauthenticated access to public share links

Skip loadUser() and exclude /shared/ from the 401 redirect interceptor
so unauthenticated users can open shared trip links without being
redirected to /login. Fixes #308.
This commit is contained in:
jubnl
2026-04-02 14:05:15 +02:00
parent 45e0c7e546
commit c944a7d101
2 changed files with 4 additions and 2 deletions

View File

@@ -26,7 +26,7 @@ apiClient.interceptors.response.use(
(response) => response,
(error) => {
if (error.response?.status === 401 && (error.response?.data as { code?: string } | undefined)?.code === 'AUTH_REQUIRED') {
if (!window.location.pathname.includes('/login') && !window.location.pathname.includes('/register')) {
if (!window.location.pathname.includes('/login') && !window.location.pathname.includes('/register') && !window.location.pathname.startsWith('/shared/')) {
window.location.href = '/login'
}
}