Use clearError in makeRequest
This commit is contained in:
parent
7a350785fe
commit
c1c8fc2f42
1 changed files with 6 additions and 6 deletions
|
|
@ -37,7 +37,7 @@ import {
|
|||
Hash,
|
||||
MessageSquare,
|
||||
Send,
|
||||
Terminal
|
||||
Terminal,
|
||||
} from "lucide-react";
|
||||
|
||||
import { toast } from "react-toastify";
|
||||
|
|
@ -72,10 +72,6 @@ const App = () => {
|
|||
prompts: null,
|
||||
tools: null,
|
||||
});
|
||||
|
||||
const clearError = (tabKey: keyof typeof errors) => {
|
||||
setErrors((prev) => ({ ...prev, [tabKey]: null }));
|
||||
};
|
||||
const [command, setCommand] = useState<string>(() => {
|
||||
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>>(
|
||||
request: ClientRequest,
|
||||
schema: T,
|
||||
|
|
@ -224,7 +224,7 @@ const App = () => {
|
|||
pushHistory(request, response);
|
||||
|
||||
if (tabKey !== undefined) {
|
||||
setErrors((prev) => ({ ...prev, [tabKey]: null }));
|
||||
clearError(tabKey);
|
||||
}
|
||||
|
||||
return response;
|
||||
|
|
|
|||
Loading…
Reference in a new issue