This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const CachableRoutePatterns = { | |
'/api/person/:id': true, | |
'https://pokeapi.co/api/v2/pokemon': false | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {HttpRequest, HttpResponse} from '@angular/common/http'; | |
import {Injectable} from '@angular/core'; | |
import {CachableRoutePatterns} from '@core/interfaces/api.interface'; | |
import {LocalStorageTypes} from '@core/interfaces/local-storage.interface'; | |
import {LocalStorageService} from '@core/services/local-storage/local-storage.service'; | |
import {Logger} from '@core/services/logger/logger'; | |
import * as Route from 'route-parser'; | |
abstract class HttpCache { | |
abstract get(req: HttpRequest<any>): HttpResponse<any> | null; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Injectable} from '@angular/core'; | |
import { | |
HttpRequest, | |
HttpHandler, | |
HttpEvent, | |
HttpResponse, HttpErrorResponse | |
} from '@angular/common/http'; | |
import {HttpCacheService} from '@core/services/http-cache/http-cache.service'; | |
import {Logger} from '@core/services/logger/logger'; | |
import {Observable, of} from 'rxjs'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Component, TemplateRef} from '@angular/core'; | |
import {FormGroup} from '@angular/forms'; | |
import {ModalOptions} from 'ngx-bootstrap/modal'; | |
export interface ConfirmModalConfig { | |
/** | |
* The text which will show in the modal-header | |
*/ | |
modalHeaderText?: string; | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="modal-header flex-row"> | |
<div class="modal-header-text"> | |
{{modalHeaderText}} | |
</div> | |
<button class="btn btn-link" (click)="bsModalRef.hide()"> | |
<i class="fas fa-times"></i> | |
</button> | |
</div> | |
<div class="modal-body"> | |
<h2 *ngIf="modalTitle" class="modalTitle">{{modalTitle}}</h2> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Component, Injector, TemplateRef} from '@angular/core'; | |
import {FormGroup} from '@angular/forms'; | |
import {BsModalRef, ModalOptions} from 'ngx-bootstrap/modal'; | |
@Component({ | |
selector: 'app-confirm-modal', | |
templateUrl: './confirm-modal.component.html', | |
styleUrls: ['./confirm-modal.component.scss'] | |
}) | |
export class ConfirmModalComponent { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Injectable} from '@angular/core'; | |
import {ServiceLocator} from '@core/services/service-locator'; | |
import {ConfirmModalComponent} from '@shared/components/confirm-modal/confirm-modal.component'; | |
import { ConfirmModalConfig } from '@shared/components/confirm-modal/confirm-modal.interface'; | |
import {BsModalService, ModalOptions} from 'ngx-bootstrap/modal'; | |
/** | |
* This service should only contain static methods for showing notifications to the user | |
*/ | |
@Injectable() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Show a very simple dialog | |
const textModalConfig = { | |
modalTitle: 'A reusable modal dialog', | |
modalTextContent: 'Here is the body of the dialog', | |
data: {foo: 'bar'}, | |
confirmButtonLabel: 'Roger that!', | |
confirmHandler: (data) => { | |
console.log('Modal confirm handler', data); | |
}, | |
cancelHandler: () => { |
OlderNewer