refactor axios.

This commit is contained in:
xuyue committed 2023-01-08 15:07:32 +08:00
1 parent e306e6b463
commit a3456595a5
4 files changed
+12 -11

No files matched your search

+2 -3
View File
@@ -8,7 +8,7 @@ import {
} from "../../../utils/constants"
import { isMobile } from "../../../utils/breakpoints"
import { submitCode } from "../../api"
import { Problem } from "../../../utils/types"
import { LANGUAGE, Problem, SubmitCodePayload } from "../../../utils/types"
const { problem, contestID = "" } = defineProps<{
contestID?: string
@@ -85,13 +85,12 @@ const submitDisabled = computed(() => {
})
async function submit() {
const data = {
const data: SubmitCodePayload = {
problem_id: problem.id,
language: state.language,
code: state.values[state.language],
}
if (contestID) {
//@ts-ignore
data.contest_id = parseInt(contestID)
}
const res = await submitCode(data)