Sprint 9: add tenant-driven API resolution layer

This commit is contained in:
sdarbinyan
2026-07-05 02:24:16 +04:00
parent c3d1153f0e
commit 487a3fb913
12 changed files with 197 additions and 17 deletions

View File

@@ -0,0 +1,18 @@
import { HttpInterceptorFn } from '@angular/common/http';
import { inject } from '@angular/core';
import { ApiConfigService } from '../core/config/api-config.service';
export const apiBaseUrlInterceptor: HttpInterceptorFn = (req, next) => {
const apiConfig = inject(ApiConfigService);
if (!req.url.startsWith('/api')) {
return next(req);
}
const resolvedUrl = apiConfig.toApiUrl(req.url);
if (resolvedUrl === req.url) {
return next(req);
}
return next(req.clone({ url: resolvedUrl }));
};