import { Injectable } from '@angular/core';
import { HttpRequest } from '@angular/common/http';
import { ObserveBeforeEffect } from 'ngx-crud';
import { NotifierService } from './notifier.service';
@Injectable()
export class OfflineEffect implements ObserveBeforeEffect
{
constructor(protected notifierService : NotifierService) {}
before<T>(request : HttpRequest<T>) : HttpRequest<T>
{
if (navigator.onLine)
{
return request;
}
notifierService.warning('OFFLINE_MODE');
}
}