Add custom HTTP interceptor and spinner service for request handling; update CORS settings
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { SpinnerService } from './spinner.service';
|
||||
|
||||
describe('SpinnerService', () => {
|
||||
let service: SpinnerService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(SpinnerService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,19 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import {BehaviorSubject} from 'rxjs';
|
||||
|
||||
@Injectable({ providedIn: 'root'})
|
||||
export class SpinnerService {
|
||||
visibility: BehaviorSubject<boolean>;
|
||||
|
||||
constructor() {
|
||||
this.visibility = new BehaviorSubject(false);
|
||||
}
|
||||
|
||||
show() {
|
||||
this.visibility.next(true);
|
||||
}
|
||||
|
||||
hide() {
|
||||
this.visibility.next(false);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user