Add FlagType and updateFlag API method to frontend
Add FlagType to type definitions and flag field to SubmissionOut/SubmissionAll interfaces. Add updateFlag method to Submission API client. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import axios from "axios"
|
import axios from "axios"
|
||||||
import { router } from "./router"
|
import { router } from "./router"
|
||||||
import type { TutorialIn, ChallengeIn } from "./utils/type"
|
import type { TutorialIn, ChallengeIn, FlagType } from "./utils/type"
|
||||||
import { BASE_URL, STORAGE_KEY } from "./utils/const"
|
import { BASE_URL, STORAGE_KEY } from "./utils/const"
|
||||||
|
|
||||||
const http = axios.create({
|
const http = axios.create({
|
||||||
@@ -167,6 +167,11 @@ export const Submission = {
|
|||||||
const res = await http.put(`/submission/${id}/score`, { score })
|
const res = await http.put(`/submission/${id}/score`, { score })
|
||||||
return res.data
|
return res.data
|
||||||
},
|
},
|
||||||
|
|
||||||
|
async updateFlag(id: string, flag: FlagType) {
|
||||||
|
const res = await http.put(`/submission/${id}/flag`, { flag })
|
||||||
|
return res.data
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Prompt = {
|
export const Prompt = {
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ export function getRole(role: Role) {
|
|||||||
}[role]
|
}[role]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type FlagType = "red" | "blue" | "green" | "yellow" | null
|
||||||
|
|
||||||
export interface TutorialSlim {
|
export interface TutorialSlim {
|
||||||
display: number
|
display: number
|
||||||
title: string
|
title: string
|
||||||
@@ -64,6 +66,7 @@ export interface SubmissionOut {
|
|||||||
score: number
|
score: number
|
||||||
my_score: number
|
my_score: number
|
||||||
conversation_id?: string
|
conversation_id?: string
|
||||||
|
flag?: FlagType
|
||||||
created: Date
|
created: Date
|
||||||
modified: Date
|
modified: Date
|
||||||
}
|
}
|
||||||
@@ -78,6 +81,7 @@ export interface SubmissionAll {
|
|||||||
task_title: string
|
task_title: string
|
||||||
score: number
|
score: number
|
||||||
my_score: number
|
my_score: number
|
||||||
|
flag?: FlagType
|
||||||
html: ""
|
html: ""
|
||||||
css: ""
|
css: ""
|
||||||
js: ""
|
js: ""
|
||||||
|
|||||||
Reference in New Issue
Block a user