Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

Cleanup App.jsx

Daniel D Orlandod24abf6a2a71
diff --git a/client/src/App.jsx b/client/src/App.jsx
index b27a410bd3..1964a148bf 100644
--- a/client/src/App.jsx
+++ b/client/src/App.jsx
@@ -59,24 +59,18 @@ const App = () => {
window.location.href = '/auth/login';
}
- useEffect(() => {
- if (searchEnabledQuery.error) {
- console.error("Failed to get search enabled", searchEnabledQuery.error);
- }
- if (searchEnabledQuery.data) {
- setIsSearchEnabled(searchEnabledQuery.data);
- }
- }, [searchEnabledQuery.data, setIsSearchEnabled, searchEnabledQuery.error]);
-
- useEffect(() => {
- if (userQuery.error) {
- console.error("Failed to get user", userQuery.error);
- }
- if (userQuery.data) {
- setUser(userQuery.data);
- }
- }, [userQuery.data, setUser, userQuery.error]);
+ if (searchEnabledQuery.data) {
+ setIsSearchEnabled(searchEnabledQuery.data);
+ } else if(searchEnabledQuery.isError) {
+ console.error("Failed to get search enabled", searchEnabledQuery.error);
+ }
+ if (userQuery.data) {
+ setUser(userQuery.data);
+ } else if(userQuery.isError) {
+ console.error("Failed to get user", userQuery.error);
+ window.location.href = '/auth/login';
+ }
if (user)
return (