Add CodeErrorDataTypeAPI and ResponseErrorTypeAPI to types/api
This commit is contained in:
parent
1753b17053
commit
1d9aed286a
2 changed files with 16 additions and 1 deletions
|
|
@ -26,6 +26,7 @@ import { useDarkStore } from "../../stores/darkStore";
|
||||||
import useFlowStore from "../../stores/flowStore";
|
import useFlowStore from "../../stores/flowStore";
|
||||||
import { codeAreaModalPropsType } from "../../types/components";
|
import { codeAreaModalPropsType } from "../../types/components";
|
||||||
import BaseModal from "../baseModal";
|
import BaseModal from "../baseModal";
|
||||||
|
import { CodeErrorDataTypeAPI } from "../../types/api";
|
||||||
|
|
||||||
export default function CodeAreaModal({
|
export default function CodeAreaModal({
|
||||||
value,
|
value,
|
||||||
|
|
@ -50,7 +51,7 @@ export default function CodeAreaModal({
|
||||||
const setSuccessData = useAlertStore((state) => state.setSuccessData);
|
const setSuccessData = useAlertStore((state) => state.setSuccessData);
|
||||||
const setErrorData = useAlertStore((state) => state.setErrorData);
|
const setErrorData = useAlertStore((state) => state.setErrorData);
|
||||||
const [error, setError] = useState<{
|
const [error, setError] = useState<{
|
||||||
detail: { error: string | undefined; traceback: string | undefined };
|
detail: CodeErrorDataTypeAPI;
|
||||||
} | null>(null);
|
} | null>(null);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
|
||||||
|
|
@ -159,3 +159,17 @@ export type VertexDataTypeAPI = {
|
||||||
timedelta?: number;
|
timedelta?: number;
|
||||||
duration?: string;
|
duration?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type CodeErrorDataTypeAPI = {
|
||||||
|
error: string | undefined;
|
||||||
|
traceback: string | undefined;
|
||||||
|
};
|
||||||
|
|
||||||
|
// the error above is inside this error.response.data.detail.error
|
||||||
|
// which comes from a request to the API
|
||||||
|
// to type the error we need to know the structure of the object
|
||||||
|
|
||||||
|
// error that has a response, that has a data, that has a detail, that has an error
|
||||||
|
export type ResponseErrorTypeAPI = {
|
||||||
|
response: { data: { detail: CodeErrorDataTypeAPI } };
|
||||||
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue