AI Implementation feature(820): Project Scaffold and Platform Foundations (#1)

This commit was merged in pull request #1.
This commit is contained in:
2026-07-21 14:23:53 +00:00
parent e55c9cda56
commit 03bcb6b156
131 changed files with 23657 additions and 0 deletions
@@ -0,0 +1,12 @@
import { HttpInterceptorFn } from '@angular/common/http';
import { inject } from '@angular/core';
import { AuthService } from '../services/auth.service';
export const authInterceptor: HttpInterceptorFn = (req, next) => {
const auth = inject(AuthService);
const token = auth.getAccessToken();
if (token) {
req = req.clone({ setHeaders: { Authorization: `Bearer ${token}` } });
}
return next(req);
};
@@ -0,0 +1,23 @@
import { HttpInterceptorFn } from '@angular/common/http';
function readCookie(name: string): string | null {
const header = document.cookie;
if (!header) return null;
for (const part of header.split(';')) {
const [k, ...v] = part.trim().split('=');
if (k === name) return v.join('=');
}
return null;
}
const UNSAFE = new Set(['POST', 'PUT', 'PATCH', 'DELETE']);
export const csrfInterceptor: HttpInterceptorFn = (req, next) => {
if (UNSAFE.has(req.method)) {
const token = readCookie('csrf');
if (token) {
req = req.clone({ setHeaders: { 'X-CSRF-Token': token } });
}
}
return next(req);
};