mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-04-02 08:58:11 +02:00
quick nit
This commit is contained in:
parent
81cb98aaa7
commit
cebc341991
@ -1,12 +1,9 @@
|
||||
import { useState, useEffect, useRef } from "react";
|
||||
import { User } from "@/lib/types";
|
||||
import { NO_AUTH_USER_ID } from "@/lib/extension/constants";
|
||||
|
||||
/**
|
||||
* Custom hook for handling JWT token refresh
|
||||
*
|
||||
* @param user The current user or null if not logged in
|
||||
* @param onRefreshFail Callback function to execute if token refresh fails
|
||||
* @returns Object containing the last token refresh timestamp
|
||||
* Custom hook for handling JWT token refresh for current user
|
||||
*/
|
||||
export function useTokenRefresh(
|
||||
user: User | null,
|
||||
@ -19,7 +16,7 @@ export function useTokenRefresh(
|
||||
const isFirstLoad = useRef(true);
|
||||
|
||||
useEffect(() => {
|
||||
if (!user) return;
|
||||
if (!user || user.id === NO_AUTH_USER_ID) return;
|
||||
|
||||
// Refresh token every 10 minutes (600000ms)
|
||||
// This is shorter than the session expiry time to ensure tokens stay valid
|
||||
|
@ -35,3 +35,5 @@ export const LocalStorageKeys = {
|
||||
export const SEARCH_PARAMS = {
|
||||
DEFAULT_SIDEBAR_OFF: "defaultSidebarOff",
|
||||
};
|
||||
|
||||
export const NO_AUTH_USER_ID = "__no_auth_user__";
|
||||
|
Loading…
x
Reference in New Issue
Block a user