feat: 认证管理实时获取token
This commit is contained in:
parent
efcdee2109
commit
76342553ad
|
@ -212,30 +212,18 @@ export class AuthManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static createAuthenticatedJtagHubConnection() {
|
public static createAuthenticatedJtagHubConnection() {
|
||||||
const token = this.getToken();
|
|
||||||
if (isNull(token)) {
|
|
||||||
router.push("/login");
|
|
||||||
throw Error("Token Null!");
|
|
||||||
}
|
|
||||||
|
|
||||||
return new HubConnectionBuilder()
|
return new HubConnectionBuilder()
|
||||||
.withUrl("http://127.0.0.1:5000/hubs/JtagHub", {
|
.withUrl("http://127.0.0.1:5000/hubs/JtagHub", {
|
||||||
accessTokenFactory: () => token,
|
accessTokenFactory: () => this.getToken() ?? "",
|
||||||
})
|
})
|
||||||
.withAutomaticReconnect()
|
.withAutomaticReconnect()
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static createAuthenticatedProgressHubConnection() {
|
public static createAuthenticatedProgressHubConnection() {
|
||||||
const token = this.getToken();
|
|
||||||
if (isNull(token)) {
|
|
||||||
router.push("/login");
|
|
||||||
throw Error("Token Null!");
|
|
||||||
}
|
|
||||||
|
|
||||||
return new HubConnectionBuilder()
|
return new HubConnectionBuilder()
|
||||||
.withUrl("http://127.0.0.1:5000/hubs/ProgressHub", {
|
.withUrl("http://127.0.0.1:5000/hubs/ProgressHub", {
|
||||||
accessTokenFactory: () => token,
|
accessTokenFactory: () => this.getToken() ?? "",
|
||||||
})
|
})
|
||||||
.withAutomaticReconnect()
|
.withAutomaticReconnect()
|
||||||
.build();
|
.build();
|
||||||
|
|
Loading…
Reference in New Issue