fix: token refresh and seed tree visibility

Fix broken JWT token refresh that caused "Failed to load trees" after
idle timeout. The refresh endpoint expected token as query param but
frontend sent it as Authorization header. Added proper dependency
(get_refresh_token_payload) and refresh queue to handle concurrent 401s.

Also fix seed trees not being visible to non-admin users by updating
the seed script to set is_public/is_default on existing trees.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Michael Chihlas
2026-02-04 20:41:37 -05:00
parent 7fc98edf1c
commit 6b8b29571e
6 changed files with 197 additions and 45 deletions

View File

@@ -15,6 +15,7 @@ interface AuthState {
register: (data: UserCreate) => Promise<void>
logout: () => Promise<void>
fetchUser: () => Promise<void>
setTokens: (token: Token) => void
clearError: () => void
setLoading: (loading: boolean) => void
}
@@ -85,6 +86,7 @@ export const useAuthStore = create<AuthState>()(
}
},
setTokens: (token: Token) => set({ token }),
clearError: () => set({ error: null }),
setLoading: (loading: boolean) => set({ isLoading: loading }),
}),