Skip to content

Commit 1092d09

Browse files
committed
Token added correctly to the request
1 parent c5d289a commit 1092d09

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/app/authentication/interceptor/basic-authentication.interceptor.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ export class BasicAuthenticationInterceptor implements HttpInterceptor {
1919
// Acquire the current user token
2020
const token = this.authenticationService.getUser().token;
2121

22-
if (token === null) {
23-
// No token
24-
// No changes to request
25-
authReq = request;
26-
} else {
22+
if (token) {
2723
// Has token
2824
// It is added to the request
2925
authReq = request.clone({ headers: request.headers.set(this.tokenHeaderKey, `${this.tokenHeaderIdentifier} ${token}`) });
26+
} else {
27+
// No token
28+
// No changes to request
29+
authReq = request;
3030
}
3131

3232
return next.handle(authReq);

0 commit comments

Comments
 (0)