refactor axios.

This commit is contained in:
2023-01-08 15:07:32 +08:00
parent e306e6b463
commit a3456595a5
4 changed files with 12 additions and 11 deletions

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)