Fix web title cleaning problem

This commit is contained in:
yangdx
2025-04-05 00:41:49 +08:00
parent 9e9dfe506f
commit 1c0b94c46f
2 changed files with 12 additions and 12 deletions

View File

@@ -427,10 +427,10 @@ export const getAuthStatus = async (): Promise<AuthStatusResponse> => {
if (!response.data.auth_configured) {
if (response.data.access_token && typeof response.data.access_token === 'string') {
// Update custom title if available
if (response.data.webui_title || response.data.webui_description) {
if ('webui_title' in response.data || 'webui_description' in response.data) {
useAuthStore.getState().setCustomTitle(
response.data.webui_title || null,
response.data.webui_description || null
'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;
@@ -440,10 +440,10 @@ export const getAuthStatus = async (): Promise<AuthStatusResponse> => {
} else {
// For configured auth, just return the data
// Update custom title if available
if (response.data.webui_title || response.data.webui_description) {
if ('webui_title' in response.data || 'webui_description' in response.data) {
useAuthStore.getState().setCustomTitle(
response.data.webui_title || null,
response.data.webui_description || null
'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;
@@ -485,10 +485,10 @@ export const loginToServer = async (username: string, password: string): Promise
});
// Update custom title if available
if (response.data.webui_title || response.data.webui_description) {
if ('webui_title' in response.data || 'webui_description' in response.data) {
useAuthStore.getState().setCustomTitle(
response.data.webui_title || null,
response.data.webui_description || null
'webui_title' in response.data ? (response.data.webui_title ?? null) : null,
'webui_description' in response.data ? (response.data.webui_description ?? null) : null
);
}

View File

@@ -51,10 +51,10 @@ const useBackendStateStoreBase = create<BackendState>()((set) => ({
}
// Update custom title information if health check returns it
if (health.webui_title || health.webui_description) {
if ('webui_title' in health || 'webui_description' in health) {
useAuthStore.getState().setCustomTitle(
health.webui_title || null,
health.webui_description || null
'webui_title' in health ? (health.webui_title ?? null) : null,
'webui_description' in health ? (health.webui_description ?? null) : null
);
}