fix: token
This commit is contained in:
@@ -3,11 +3,11 @@ import { HttpInterceptorFn } from '@angular/common/http';
|
|||||||
export const authInterceptor: HttpInterceptorFn = (req, next) => {
|
export const authInterceptor: HttpInterceptorFn = (req, next) => {
|
||||||
const token = localStorage.getItem('token');
|
const token = localStorage.getItem('token');
|
||||||
|
|
||||||
// Add token to protected endpoints only (not registration or login)
|
|
||||||
const isProtectedEndpoint =
|
const isProtectedEndpoint =
|
||||||
req.url.includes('/api/account/me') ||
|
req.url.includes('/api/account/me') ||
|
||||||
req.url.includes('/api/account/bots') ||
|
req.url.includes('/api/account/bots') ||
|
||||||
req.url.includes('/api/account/official-bots') ||
|
req.url.includes('/api/account/official-bots') ||
|
||||||
|
req.url.includes('/api/board/game') ||
|
||||||
req.url.includes('/api/challenge');
|
req.url.includes('/api/challenge');
|
||||||
|
|
||||||
if (token && isProtectedEndpoint) {
|
if (token && isProtectedEndpoint) {
|
||||||
|
|||||||
Reference in New Issue
Block a user