add github

This commit is contained in:
2026-06-30 15:20:26 +07:00
parent 38e22b3390
commit 840ddcdce9
4 changed files with 234 additions and 54 deletions

View File

@@ -838,12 +838,22 @@ export const apiExam = {
},
publishSubmissionsGit: async (id: number) => {
const res = await staffFetch(`/exam-rooms/${id}/submissions/publish-git`, { method: 'POST' });
if (!res.ok) await parseError(res, 'Đẩy lên Git thất bại');
if (!res.ok) {
const errData = await res.json().catch(() => ({} as { error?: string; warnings?: string[] }));
const msg = errData.error || 'Đẩy lên Git thất bại';
if (errData.warnings?.length) throw new Error(`${msg}${errData.warnings.join('; ')}`);
throw new Error(msg);
}
return res.json() as Promise<{ ok: boolean; url: string; gitPublishUrl: string; openUrl?: string; message: string }>;
},
publishSubmissionsGitStudents: async (id: number) => {
const res = await staffFetch(`/exam-rooms/${id}/submissions/publish-git-students`, { method: 'POST' });
if (!res.ok) await parseError(res, 'Đẩy repo từng SV thất bại');
if (!res.ok) {
const errData = await res.json().catch(() => ({} as { error?: string; warnings?: string[] }));
const msg = errData.error || 'Đẩy repo từng SV thất bại';
if (errData.warnings?.length) throw new Error(`${msg}${errData.warnings.join('; ')}`);
throw new Error(msg);
}
return res.json() as Promise<{
ok: boolean;
published: number;