refactor: 使用更简洁的方式进行认证
This commit is contained in:
@@ -418,7 +418,12 @@ import {
|
||||
FileArchiveIcon,
|
||||
FileJsonIcon,
|
||||
} from "lucide-vue-next";
|
||||
import { ExamDto, type FileParameter } from "@/APIClient";
|
||||
import {
|
||||
ExamClient,
|
||||
ExamDto,
|
||||
ResourceClient,
|
||||
type FileParameter,
|
||||
} from "@/APIClient";
|
||||
import { useAlertStore } from "@/components/Alert";
|
||||
import { AuthManager } from "@/utils/AuthManager";
|
||||
import { useRequiredInjection } from "@/utils/Common";
|
||||
@@ -618,7 +623,7 @@ const submitCreateExam = async () => {
|
||||
isUpdating.value = true;
|
||||
|
||||
try {
|
||||
const client = AuthManager.createAuthenticatedExamClient();
|
||||
const client = AuthManager.createClient(ExamClient);
|
||||
|
||||
let exam: ExamInfo;
|
||||
if (mode.value === "create") {
|
||||
@@ -671,7 +676,7 @@ const submitCreateExam = async () => {
|
||||
|
||||
// 上传实验资源
|
||||
async function uploadExamResources(examId: string) {
|
||||
const client = AuthManager.createAuthenticatedResourceClient();
|
||||
const client = AuthManager.createClient(ResourceClient);
|
||||
|
||||
try {
|
||||
// 上传MD文档
|
||||
@@ -750,7 +755,7 @@ function close() {
|
||||
}
|
||||
|
||||
async function editExam(examId: string) {
|
||||
const client = AuthManager.createAuthenticatedExamClient();
|
||||
const client = AuthManager.createClient(ExamClient);
|
||||
const examInfo = await client.getExam(examId);
|
||||
|
||||
editExamInfo.value = {
|
||||
|
||||
Reference in New Issue
Block a user