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