openaire-library/services/clear-cache.service.ts

19 lines
553 B
TypeScript
Raw Normal View History

import {Injectable} from "@angular/core";
import {HttpClient} from "@angular/common/http";
import {properties} from "../../../environments/environment";
@Injectable({
providedIn: 'root'
})
export class ClearCacheService {
constructor(private http: HttpClient) {}
clearCache(message: string = null) {
this.http.get(properties.deleteCacheUrl).subscribe(
res => console.log((message ? message+": " : "") + "Cache cleared!"),
err => console.log((message ? message+": " : "") + "Cache could not be cleared ", err)
);
}
}