mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-18 09:20: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 { createBrowserRouter, RouterProvider, Navigate } from 'react-router-dom';
|
||||||
import Root from './routes/Root';
|
import Root from './routes/Root';
|
||||||
import Chat from './routes/Chat';
|
import Chat from './routes/Chat';
|
||||||
|
|
@ -44,32 +45,40 @@ const App = () => {
|
||||||
const endpointsQuery = useGetEndpointsQuery();
|
const endpointsQuery = useGetEndpointsQuery();
|
||||||
const presetsQuery = useGetPresetsQuery();
|
const presetsQuery = useGetPresetsQuery();
|
||||||
|
|
||||||
if(endpointsQuery.data) {
|
useEffect(() => {
|
||||||
setEndpointsConfig(endpointsQuery.data);
|
if(endpointsQuery.data) {
|
||||||
} else if(endpointsQuery.isError) {
|
setEndpointsConfig(endpointsQuery.data);
|
||||||
console.error("Failed to get endpoints", endpointsQuery.error);
|
} else if(endpointsQuery.isError) {
|
||||||
window.location.href = '/auth/login';
|
console.error("Failed to get endpoints", endpointsQuery.error);
|
||||||
}
|
window.location.href = '/auth/login';
|
||||||
|
}
|
||||||
|
}, [endpointsQuery.data, endpointsQuery.isError]);
|
||||||
|
|
||||||
if(presetsQuery.data) {
|
useEffect(() => {
|
||||||
setPresets(presetsQuery.data);
|
if(presetsQuery.data) {
|
||||||
} else if(presetsQuery.isError) {
|
setPresets(presetsQuery.data);
|
||||||
console.error("Failed to get presets", presetsQuery.error);
|
} else if(presetsQuery.isError) {
|
||||||
window.location.href = '/auth/login';
|
console.error("Failed to get presets", presetsQuery.error);
|
||||||
}
|
window.location.href = '/auth/login';
|
||||||
|
}
|
||||||
|
}, [presetsQuery.data, presetsQuery.isError]);
|
||||||
|
|
||||||
if (searchEnabledQuery.data) {
|
useEffect(() => {
|
||||||
setIsSearchEnabled(searchEnabledQuery.data);
|
if (searchEnabledQuery.data) {
|
||||||
} else if(searchEnabledQuery.isError) {
|
setIsSearchEnabled(searchEnabledQuery.data);
|
||||||
console.error("Failed to get search enabled", searchEnabledQuery.error);
|
} else if(searchEnabledQuery.isError) {
|
||||||
}
|
console.error("Failed to get search enabled", searchEnabledQuery.error);
|
||||||
|
}
|
||||||
|
}, [searchEnabledQuery.data, searchEnabledQuery.isError]);
|
||||||
|
|
||||||
if (userQuery.data) {
|
useEffect(() => {
|
||||||
setUser(userQuery.data);
|
if (userQuery.data) {
|
||||||
} else if(userQuery.isError) {
|
setUser(userQuery.data);
|
||||||
console.error("Failed to get user", userQuery.error);
|
} else if(userQuery.isError) {
|
||||||
window.location.href = '/auth/login';
|
console.error("Failed to get user", userQuery.error);
|
||||||
}
|
window.location.href = '/auth/login';
|
||||||
|
}
|
||||||
|
}, [userQuery.data, userQuery.isError]);
|
||||||
|
|
||||||
if (user)
|
if (user)
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue