update pos consumer
This commit is contained in:
@@ -7,8 +7,6 @@ import { environment } from 'src/environments/environment';
|
||||
@Injectable()
|
||||
export class ApiBaseUrlInterceptor implements HttpInterceptor {
|
||||
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
|
||||
console.log('first');
|
||||
|
||||
const cookieService = inject(CookieService);
|
||||
// Prepare default headers but don't overwrite existing ones
|
||||
const defaultHeaders: Record<string, string> = {
|
||||
@@ -33,12 +31,13 @@ export class ApiBaseUrlInterceptor implements HttpInterceptor {
|
||||
}
|
||||
});
|
||||
|
||||
console.log('req.url');
|
||||
console.log(req.url);
|
||||
|
||||
// Only prepend base URL if the request URL is relative (does not start with http or https)
|
||||
if (!/^https?:\/\//i.test(req.url)) {
|
||||
const apiReq = req.clone({ url: environment.apiBaseUrl + req.url, setHeaders: headersToSet });
|
||||
const apiReq = req.clone({
|
||||
url: environment.apiBaseUrl + req.url,
|
||||
setHeaders: headersToSet,
|
||||
credentials: 'include',
|
||||
});
|
||||
return next.handle(apiReq);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@ import { AuthService } from '../services/auth.service';
|
||||
* - Prevents duplicate refresh token requests
|
||||
*/
|
||||
export const authInterceptor: HttpInterceptorFn = (req, next) => {
|
||||
console.log('authInterceptor');
|
||||
|
||||
const authService = inject(AuthService);
|
||||
|
||||
// Skip auth for certain endpoints
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
import { ValidatorFn } from '@angular/forms';
|
||||
|
||||
export function nationalIdValidator(): ValidatorFn {
|
||||
return (control) => {
|
||||
if (control.value === null || control.value === undefined || control.value === '') {
|
||||
return null;
|
||||
}
|
||||
return control.value.length === 10 && /^[0-9]{10}$/.test(control.value)
|
||||
? null
|
||||
: { nationalId: true };
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user