refactor: 使用更简洁的方式进行认证
This commit is contained in:
@@ -95,6 +95,7 @@ import {
|
||||
import { ProgressStatus } from "@/utils/signalR/server.Hubs";
|
||||
import { useRequiredInjection } from "@/utils/Common";
|
||||
import { useAlertStore } from "./Alert";
|
||||
import { ResourceClient } from "@/APIClient";
|
||||
|
||||
interface Props {
|
||||
maxMemory?: number;
|
||||
@@ -138,8 +139,7 @@ const progressHubReceiver: IProgressReceiver = {
|
||||
},
|
||||
};
|
||||
onMounted(async () => {
|
||||
progressHubConnection.value =
|
||||
AuthManager.createAuthenticatedProgressHubConnection();
|
||||
progressHubConnection.value = AuthManager.createHubConnection("ProgressHub");
|
||||
progressHubProxy.value = getHubProxyFactory("IProgressHub").createHubProxy(
|
||||
progressHubConnection.value,
|
||||
);
|
||||
@@ -175,7 +175,7 @@ async function loadAvailableBitstreams() {
|
||||
}
|
||||
|
||||
try {
|
||||
const resourceClient = AuthManager.createAuthenticatedResourceClient();
|
||||
const resourceClient = AuthManager.createClient(ResourceClient);
|
||||
// 使用新的ResourceClient API获取比特流模板资源列表
|
||||
const resources = await resourceClient.getResourceList(
|
||||
props.examId,
|
||||
@@ -199,7 +199,7 @@ async function downloadExampleBitstream(bitstream: {
|
||||
|
||||
isDownloading.value = true;
|
||||
try {
|
||||
const resourceClient = AuthManager.createAuthenticatedResourceClient();
|
||||
const resourceClient = AuthManager.createClient(ResourceClient);
|
||||
|
||||
// 使用新的ResourceClient API获取资源文件
|
||||
const response = await resourceClient.getResourceById(bitstream.id);
|
||||
|
||||
Reference in New Issue
Block a user