diff --git a/.changes/splash.md b/.changes/splash.md new file mode 100644 index 0000000..6c58ed2 --- /dev/null +++ b/.changes/splash.md @@ -0,0 +1,5 @@ +--- +"algohub": patch:feat +--- + +Add splash screen before loading index page. diff --git a/src/components/MonacoEditor.vue b/src/components/MonacoEditor.vue index 7a633c0..fc494a2 100644 --- a/src/components/MonacoEditor.vue +++ b/src/components/MonacoEditor.vue @@ -104,7 +104,7 @@ const onSubmit = () => { emit( 'submit', rawEditor.value.getValue(), - language, + language.value, (text: string, severity: Severity) => { submitting.value = false message.value = { text, severity } diff --git a/src/components/SplashScreen.vue b/src/components/SplashScreen.vue new file mode 100644 index 0000000..e823da2 --- /dev/null +++ b/src/components/SplashScreen.vue @@ -0,0 +1,88 @@ + + + \ No newline at end of file diff --git a/src/scripts/api.ts b/src/scripts/api.ts index babf472..ff07f29 100644 --- a/src/scripts/api.ts +++ b/src/scripts/api.ts @@ -8,6 +8,8 @@ import type { Profile, UserContent, CreateProblem, + Language, + RecordId, } from "./types"; export interface Response { @@ -79,6 +81,15 @@ export const login = async (form: Login) => { } }; +export const verifyToken = async (auth?: Credentials) => { + try { + const response = await axios.post("/account/verify", auth); + return response.data as Response; + } catch (error) { + return handleAxiosError(AxiosError.from(error)); + } +}; + export const fetchProfile = async (id: string) => { try { const response = await axios.get(`/account/profile/${id}`); @@ -131,10 +142,34 @@ interface SubmitCodeForm { lang: string; } +interface Id { + id: string; +} + export const submitCode = async (problem_id: string, form: SubmitCodeForm) => { try { const response = await axios.post(`/code/submit/${problem_id}`, form); - return response.data as Response; + return response.data as Response; + } catch (error) { + return handleAxiosError(AxiosError.from(error)); + } +}; + +interface Submission { + id: string; + lang: Language; + problem: RecordId; + code: string; + status: 'in_queue' | 'judging' | 'ready'; + judge_details: { status: any, timeUsed: number, memoryUsed: number }[], + judge_result: { status: any, timeUsed: number, memoryUsed: number }, + // contest +} + +export const fetchSubmission = async (id: string, form?: Credentials) => { + try { + const response = await axios.post(`/code/get/${id}`, form); + return response.data as Response; } catch (error) { return handleAxiosError(AxiosError.from(error)); } diff --git a/src/views/index.vue b/src/views/index.vue index b7d2a58..3d205cb 100644 --- a/src/views/index.vue +++ b/src/views/index.vue @@ -1,20 +1,18 @@