mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-16 16:30:15 +01:00
fix bad setState warning in console
This commit is contained in:
parent
644ff160fc
commit
e0f9e92bfc
1 changed files with 32 additions and 23 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import { useEffect } from 'react';
|
||||
import { createBrowserRouter, RouterProvider, Navigate } from 'react-router-dom';
|
||||
import Root from './routes/Root';
|
||||
import Chat from './routes/Chat';
|
||||
|
|
@ -44,32 +45,40 @@ const App = () => {
|
|||
const endpointsQuery = useGetEndpointsQuery();
|
||||
const presetsQuery = useGetPresetsQuery();
|
||||
|
||||
if(endpointsQuery.data) {
|
||||
setEndpointsConfig(endpointsQuery.data);
|
||||
} else if(endpointsQuery.isError) {
|
||||
console.error("Failed to get endpoints", endpointsQuery.error);
|
||||
window.location.href = '/auth/login';
|
||||
}
|
||||
useEffect(() => {
|
||||
if(endpointsQuery.data) {
|
||||
setEndpointsConfig(endpointsQuery.data);
|
||||
} else if(endpointsQuery.isError) {
|
||||
console.error("Failed to get endpoints", endpointsQuery.error);
|
||||
window.location.href = '/auth/login';
|
||||
}
|
||||
}, [endpointsQuery.data, endpointsQuery.isError]);
|
||||
|
||||
if(presetsQuery.data) {
|
||||
setPresets(presetsQuery.data);
|
||||
} else if(presetsQuery.isError) {
|
||||
console.error("Failed to get presets", presetsQuery.error);
|
||||
window.location.href = '/auth/login';
|
||||
}
|
||||
useEffect(() => {
|
||||
if(presetsQuery.data) {
|
||||
setPresets(presetsQuery.data);
|
||||
} else if(presetsQuery.isError) {
|
||||
console.error("Failed to get presets", presetsQuery.error);
|
||||
window.location.href = '/auth/login';
|
||||
}
|
||||
}, [presetsQuery.data, presetsQuery.isError]);
|
||||
|
||||
if (searchEnabledQuery.data) {
|
||||
setIsSearchEnabled(searchEnabledQuery.data);
|
||||
} else if(searchEnabledQuery.isError) {
|
||||
console.error("Failed to get search enabled", searchEnabledQuery.error);
|
||||
}
|
||||
useEffect(() => {
|
||||
if (searchEnabledQuery.data) {
|
||||
setIsSearchEnabled(searchEnabledQuery.data);
|
||||
} else if(searchEnabledQuery.isError) {
|
||||
console.error("Failed to get search enabled", searchEnabledQuery.error);
|
||||
}
|
||||
}, [searchEnabledQuery.data, searchEnabledQuery.isError]);
|
||||
|
||||
if (userQuery.data) {
|
||||
setUser(userQuery.data);
|
||||
} else if(userQuery.isError) {
|
||||
console.error("Failed to get user", userQuery.error);
|
||||
window.location.href = '/auth/login';
|
||||
}
|
||||
useEffect(() => {
|
||||
if (userQuery.data) {
|
||||
setUser(userQuery.data);
|
||||
} else if(userQuery.isError) {
|
||||
console.error("Failed to get user", userQuery.error);
|
||||
window.location.href = '/auth/login';
|
||||
}
|
||||
}, [userQuery.data, userQuery.isError]);
|
||||
|
||||
if (user)
|
||||
return (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue