Use clearError in makeRequest
This commit is contained in:
@@ -37,7 +37,7 @@ import {
|
|||||||
Hash,
|
Hash,
|
||||||
MessageSquare,
|
MessageSquare,
|
||||||
Send,
|
Send,
|
||||||
Terminal
|
Terminal,
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
|
|
||||||
import { toast } from "react-toastify";
|
import { toast } from "react-toastify";
|
||||||
@@ -72,10 +72,6 @@ const App = () => {
|
|||||||
prompts: null,
|
prompts: null,
|
||||||
tools: null,
|
tools: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
const clearError = (tabKey: keyof typeof errors) => {
|
|
||||||
setErrors((prev) => ({ ...prev, [tabKey]: null }));
|
|
||||||
};
|
|
||||||
const [command, setCommand] = useState<string>(() => {
|
const [command, setCommand] = useState<string>(() => {
|
||||||
return localStorage.getItem("lastCommand") || "mcp-server-everything";
|
return localStorage.getItem("lastCommand") || "mcp-server-everything";
|
||||||
});
|
});
|
||||||
@@ -210,6 +206,10 @@ const App = () => {
|
|||||||
]);
|
]);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const clearError = (tabKey: keyof typeof errors) => {
|
||||||
|
setErrors((prev) => ({ ...prev, [tabKey]: null }));
|
||||||
|
};
|
||||||
|
|
||||||
const makeRequest = async <T extends ZodType<object>>(
|
const makeRequest = async <T extends ZodType<object>>(
|
||||||
request: ClientRequest,
|
request: ClientRequest,
|
||||||
schema: T,
|
schema: T,
|
||||||
@@ -224,7 +224,7 @@ const App = () => {
|
|||||||
pushHistory(request, response);
|
pushHistory(request, response);
|
||||||
|
|
||||||
if (tabKey !== undefined) {
|
if (tabKey !== undefined) {
|
||||||
setErrors((prev) => ({ ...prev, [tabKey]: null }));
|
clearError(tabKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
|
|||||||
Reference in New Issue
Block a user