add github
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user