fix: 前端编译错误 (#68)

Reviewed-on: PostGuard/Canon#68
This commit is contained in:
jackfiled 2024-04-30 09:34:31 +08:00
parent 911c813996
commit a349f0d9c0
4 changed files with 8 additions and 10 deletions

View File

@ -1,5 +0,0 @@
import * as openapi from '../openapi';
export interface OutputIntf {
data : openapi.components["schemas"]["CompileResponse"]
}

View File

@ -13,7 +13,6 @@ import {
import createClient from "openapi-fetch"; import createClient from "openapi-fetch";
import * as openapi from "../openapi"; import * as openapi from "../openapi";
import {useEffect, useState} from "react"; import {useEffect, useState} from "react";
import {OutputIntf} from "../Interfaces/OutputIntf.ts";
import {useNavigate} from "react-router-dom"; import {useNavigate} from "react-router-dom";
import {enqueueSnackbar} from "notistack"; import {enqueueSnackbar} from "notistack";
@ -22,7 +21,7 @@ const client = createClient<openapi.paths>();
// @ts-expect-error ... // @ts-expect-error ...
export function HistoryPage({state, setState}) { export function HistoryPage({state, setState}) {
const [data, setData] = useState<OutputIntf[]>([]); const [data, setData] = useState<openapi.components["schemas"]["CompileResponse"][]>([]);
const [deleteDialog, setDeleteDialog] = useState(false); const [deleteDialog, setDeleteDialog] = useState(false);
const navigate = useNavigate(); const navigate = useNavigate();
useEffect(() => { useEffect(() => {

View File

@ -56,7 +56,7 @@ export function Index() {
} }
} }
getCompileInstance(); getCompileInstance();
}, [location.pathname]); }, []);
const handleValueChange = (value: string) => { const handleValueChange = (value: string) => {

View File

@ -2,9 +2,13 @@ import { CSSProperties, useState } from "react";
import { Box, ToggleButton, ToggleButtonGroup } from "@mui/material"; import { Box, ToggleButton, ToggleButtonGroup } from "@mui/material";
import { PhotoProvider, PhotoView } from "react-photo-view"; import { PhotoProvider, PhotoView } from "react-photo-view";
import MonacoEditor from "react-monaco-editor"; import MonacoEditor from "react-monaco-editor";
import { OutputIntf } from "../Interfaces/OutputIntf"; import * as openapi from "../openapi";
export function OutputField(props: OutputIntf) { interface OutputFieldProps {
data : openapi.components["schemas"]["CompileResponse"]
}
export function OutputField(props: OutputFieldProps) {
const [state, setState] = useState('tree') const [state, setState] = useState('tree')
const { imageAddress, compiledCode, compileInformation } = props.data; const { imageAddress, compiledCode, compileInformation } = props.data;