Project

General

Profile

1
import {Injectable} from "@angular/core";
2
import {HttpClient} from "@angular/common/http";
3
import {properties} from "../../../environments/environment";
4

    
5
@Injectable({
6
  providedIn: 'root'
7
})
8
export class ClearCacheService {
9

    
10
  constructor(private http: HttpClient) {}
11

    
12
  clearCache(message: string = null) {
13
    this.http.get(properties.deleteCacheUrl).subscribe(
14
        res => console.log((message ? message+": " : "") + "Cache cleared!"),
15
        err => console.log((message ? message+": " : "") + "Cache could not be cleared ", err)
16
      );
17
  }
18
}
(2-2/23)