• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

COS301-SE-2024 / ECHO / 11092462749

29 Sep 2024 12:03PM UTC coverage: 65.619% (-2.7%) from 68.342%
11092462749

Pull #415

github

web-flow
Merge d3626b5cc into 1cba1227b
Pull Request #415: Feat/render deployment

164 of 388 branches covered (42.27%)

Branch coverage included in aggregate %.

36 of 75 new or added lines in 7 files covered. (48.0%)

38 existing lines in 3 files now uncovered.

1590 of 2285 relevant lines covered (69.58%)

5.84 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

19.35
/Frontend/src/app/authcallback/authcallback.component.ts
1
import { Component, OnInit } from "@angular/core";
1✔
2
import { Router, ActivatedRoute } from "@angular/router";
1✔
3
import { AuthService } from '../services/auth.service';
1✔
4
import { SpotifyService } from "../services/spotify.service";
1✔
5
import { TokenService } from "../services/token.service";
1✔
6

7
@Component({
8
  selector: "app-auth-callback",
9
  template: `
10
    <div class="flex flex-col items-center justify-center h-screen bg-desktop-bg">
11
      <h1 class="text-2xl font-bold mb-4 text-gray-300">Processing login</h1>
12
      <div class="animate-spin rounded-full h-16 w-16 border-t-2 border-b-2 border-blue-500"></div>
13
    </div>
14
  `,
15
  standalone: true
16
})
17
export class AuthCallbackComponent implements OnInit {
1✔
18
  constructor(
UNCOV
19
    private authService: AuthService,
×
UNCOV
20
    private router: Router,
×
UNCOV
21
    private spotifyService: SpotifyService,
×
UNCOV
22
    private tokenService: TokenService,
×
NEW
23
    private route: ActivatedRoute
×
24
  ) {}
25

26
  async ngOnInit() {
NEW
27
    this.route.fragment.subscribe(async (fragment) => {
×
NEW
28
      if (fragment) {
×
NEW
29
        const tokens = this.parseHashParams(fragment);
×
30

NEW
31
        if (tokens.accessToken && tokens.refreshToken) {
×
NEW
32
          await this.tokenService.setTokens(tokens.accessToken, tokens.refreshToken);
×
NEW
33
          this.authService.sendTokensToServer(tokens).subscribe({
×
34
            next: async (res: any) => {
NEW
35
              console.log("Login successful:", res);
×
NEW
36
              await this.spotifyService.init();
×
NEW
37
              await this.router.navigate(["/home"]);
×
38
            },
39
            error: (err: any) => {
NEW
40
              console.error("Error processing login:", err);
×
NEW
41
              this.router.navigate(["/login"]);
×
42
            }
43
          });
44
        } else {
NEW
45
          console.error("No tokens found in URL hash");
×
NEW
46
          this.router.navigate(["/login"]);
×
47
        }
48
      }
49
    });
50
  }
51

52
  parseHashParams(hash: string) {
NEW
53
    const params = new URLSearchParams(hash);
×
UNCOV
54
    return {
×
55
      accessToken: params.get("access_token"),
56
      refreshToken: params.get("refresh_token"),
57
      providerToken: params.get("provider_token"),
58
      providerRefreshToken: params.get("provider_refresh_token"),
59
      expiresAt: params.get("expires_at")
60
    };
61
  }
62
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc