Fix webtitle display problem

This commit is contained in:
yangdx
2025-04-05 02:24:23 +08:00
parent 6e515ba6ca
commit 299c508f27
5 changed files with 15 additions and 28 deletions

View File

@@ -3,7 +3,6 @@ import { backendBaseUrl } from '@/lib/constants'
import { errorMessage } from '@/lib/utils'
import { useSettingsStore } from '@/stores/settings'
import { navigationService } from '@/services/navigation'
import { useAuthStore } from '@/stores/state'
// Types
export type LightragNodeType = {
@@ -426,26 +425,12 @@ export const getAuthStatus = async (): Promise<AuthStatusResponse> => {
// For unconfigured auth, ensure we have an access token
if (!response.data.auth_configured) {
if (response.data.access_token && typeof response.data.access_token === 'string') {
// Update custom title if available
if ('webui_title' in response.data || 'webui_description' in response.data) {
useAuthStore.getState().setCustomTitle(
'webui_title' in response.data ? (response.data.webui_title ?? null) : null,
'webui_description' in response.data ? (response.data.webui_description ?? null) : null
);
}
return response.data;
} else {
console.warn('Auth not configured but no valid access token provided');
}
} else {
// For configured auth, just return the data
// Update custom title if available
if ('webui_title' in response.data || 'webui_description' in response.data) {
useAuthStore.getState().setCustomTitle(
'webui_title' in response.data ? (response.data.webui_title ?? null) : null,
'webui_description' in response.data ? (response.data.webui_description ?? null) : null
);
}
return response.data;
}
}
@@ -484,13 +469,5 @@ export const loginToServer = async (username: string, password: string): Promise
}
});
// Update custom title if available
if ('webui_title' in response.data || 'webui_description' in response.data) {
useAuthStore.getState().setCustomTitle(
'webui_title' in response.data ? (response.data.webui_title ?? null) : null,
'webui_description' in response.data ? (response.data.webui_description ?? null) : null
);
}
return response.data;
}