2020-09-24 13:18:24 +02:00
|
|
|
import {Injectable} from "@angular/core";
|
|
|
|
import {HttpClient} from "@angular/common/http";
|
|
|
|
import {properties} from "../../../environments/environment";
|
2022-08-11 14:46:55 +02:00
|
|
|
import {CustomOptions} from "./servicesUtils/customOptions.class";
|
2020-09-24 13:18:24 +02:00
|
|
|
|
|
|
|
@Injectable({
|
|
|
|
providedIn: 'root'
|
|
|
|
})
|
|
|
|
export class ClearCacheService {
|
|
|
|
|
|
|
|
constructor(private http: HttpClient) {}
|
|
|
|
|
|
|
|
clearCache(message: string = null) {
|
2022-08-08 13:14:43 +02:00
|
|
|
if(properties.deleteCacheUrl) {
|
|
|
|
this.http.get(properties.deleteCacheUrl).subscribe(
|
|
|
|
res => console.log((message ? message + ": " : "") + "Cache cleared!"),
|
|
|
|
err => console.log((message ? message + ": " : "") + "Cache could not be cleared ", err)
|
2020-09-24 13:18:24 +02:00
|
|
|
);
|
2022-08-08 13:14:43 +02:00
|
|
|
}
|
2020-09-24 13:18:24 +02:00
|
|
|
}
|
2022-08-11 11:58:20 +02:00
|
|
|
|
|
|
|
purgeBrowserCache(message: string = null, pid: string) {
|
|
|
|
if(properties.deleteBrowserCacheUrl) {
|
2022-08-11 14:46:55 +02:00
|
|
|
let url = properties.deleteBrowserCacheUrl + "/" + pid;
|
|
|
|
this.http.get(url, CustomOptions.registryOptions()).subscribe(
|
2022-08-11 11:58:20 +02:00
|
|
|
res => console.log((message ? message + ": " : "") + "Browser Cache purged!"),
|
|
|
|
err => console.log((message ? message + ": " : "") + "Browser Cache could not be purged ", err)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2020-09-24 13:18:24 +02:00
|
|
|
}
|