Skip to content

Commit 5ba7448

Browse files
committed
chore(web): prettier format auth files + npm audit fix (clear high-severity fast-uri)
1 parent 4090134 commit 5ba7448

3 files changed

Lines changed: 15 additions & 13 deletions

File tree

docanalytics-web/package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docanalytics-web/src/app/core/services/auth.service.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ describe('AuthService', () => {
4646
doLogin();
4747
service.logout();
4848
const req = httpMock.expectOne((r) => r.url === `${base}/auth/logout`);
49-
expect(req.request.body).toEqual({}); // token is in the cookie, not the body
50-
expect(req.request.withCredentials).toBe(true); // cookie must ride along
49+
expect(req.request.body).toEqual({}); // token is in the cookie, not the body
50+
expect(req.request.withCredentials).toBe(true); // cookie must ride along
5151
req.flush({ data: { logged_out: true }, error: null });
5252
expect(localStorage.getItem('da_token')).toBeNull();
5353
});
@@ -64,7 +64,7 @@ describe('AuthService', () => {
6464
service.refreshToken().subscribe((t) => (emitted = t));
6565

6666
const req = httpMock.expectOne((r) => r.url === `${base}/auth/refresh`);
67-
expect(req.request.body).toEqual({}); // refresh token comes from the cookie
67+
expect(req.request.body).toEqual({}); // refresh token comes from the cookie
6868
expect(req.request.withCredentials).toBe(true);
6969
req.flush({ data: { token: 'jwt-456' }, error: null });
7070

docanalytics-web/src/app/core/services/auth.service.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@ import { Injectable, computed, inject, signal } from '@angular/core';
33
import { Observable, catchError, finalize, firstValueFrom, map, of, shareReplay, tap } from 'rxjs';
44
import { environment } from '../../../environments/environment';
55
import { ApiResponse } from '../models/api-response.model';
6-
import { AuthUser, LoginResponse, MeResponse, RefreshResponse, SiteSummary } from '../models/auth.model';
6+
import {
7+
AuthUser,
8+
LoginResponse,
9+
MeResponse,
10+
RefreshResponse,
11+
SiteSummary,
12+
} from '../models/auth.model';
713
import { Router } from '@angular/router';
814

915
const TOKEN_KEY = 'da_token';
@@ -65,11 +71,7 @@ export class AuthService {
6571
if (this.refreshInFlight$) return this.refreshInFlight$;
6672

6773
this.refreshInFlight$ = this.http
68-
.post<ApiResponse<RefreshResponse>>(
69-
`${this.baseUrl}/refresh`,
70-
{},
71-
{ withCredentials: true },
72-
)
74+
.post<ApiResponse<RefreshResponse>>(`${this.baseUrl}/refresh`, {}, { withCredentials: true })
7375
.pipe(
7476
map((res) => {
7577
if (res.data) {
@@ -112,7 +114,7 @@ export class AuthService {
112114
logout(): void {
113115
this.http
114116
.post(`${this.baseUrl}/logout`, {}, { withCredentials: true })
115-
.subscribe({ error: () => { } });
117+
.subscribe({ error: () => {} });
116118
this.clearSession();
117119
}
118120

0 commit comments

Comments
 (0)